Additional content element in TYPO3 menu - drop-down-menu

I made a menu in TypoScript in which on drop down section I have list of subpages and list of news. The code of menu is working but it render the list of news after every subpage (subpage1 and list of news, subpage 2 and list of news... etc). I would like to have two
independent element (one list of subpages and one list of news), but i don't know how to achieve that?
here is my menu code:
lib.header_main-menu = COA
lib.header_main-menu {
10 = HMENU
10 {
wrap = <ul class="nav navbar-nav">|</ul>
entryLevel = 0
1 = TMENU
1 {
noBlur = 1
wrap = |
expAll = 1
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <li>|</li>
stdWrap.htmlSpecialChars = 1
}
}
2 = TMENU
2 {
expAll = 1
wrap = <div class="subnav-wrapper"><ul class="subnav">|</ul></div>
NO = 1
NO {
wrapItemAndSub = <li>|</li>
wrapItemAndSub.append = COA
wrapItemAndSub.append {
wrap = |
10 = CONTENT
10 < lib.header_menu_news
}
}
}
}

lib.header_main-menu = COA
lib.header_main-menu {
wrap = <div>|</div>
// this is section 10 of the COA
10 = HMENU
10 {
wrap = <ul class="nav navbar-nav">|</ul>
entryLevel = 0
1 = TMENU
1 {
noBlur = 1
wrap = |
expAll = 1
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <li>|</li>
stdWrap.htmlSpecialChars = 1
}
}
2 = TMENU
2 {
expAll = 1
wrap = <div class="subnav-wrapper"><ul class="subnav">|</ul></div>
NO = 1
NO {
wrapItemAndSub = <li>|</li>
}
}
}
// this is section 20 of the COA
// btw the next line isn't necessary, you do that (define the object type) in lib.header_menu_news already
// 10 (would be 20 now) = CONTENT
20 < lib.header_menu_news
20.wrap = <h3>News</h3>|
}
actually, this comes to the same as putting them into the template separately
<div>###MENU###
<h3>News</h3>
###NEWSMENU###</div>
btw unless you use the lib.object in the Backend somewhere, I would use temp. instead - the latter are unset after building the page object, and my guess would be that this might be better for performance.

Related

Not able to render Folder page content of template in TYPO3

I have created one default column for the footer section for my template. And by using this typoscript.
lib.footer = COA
lib.footer {
10 = CONTENT
10 {
table = tt_content
select.orderBy = sorting
select.where = colPos=4
}
}
And tried this one too,
lib.footer = CONTENT
lib.footer {
table = tt_content
select.orderBy = sorting
select.where = colPos=4
slide = -1
}
I am able to render in the all pages except the pages which are in the Folder. So, what should be the solution in this case ?
Backendview
Outout
Try to something like this for display content.
lib.footer = RECORDS
lib.footer {
source = 1 // add content id
dontCheckPid = 1
tables = tt_content
}
For footer Menu like AGB |TEST | use below typoscript
lib.footermenu = COA
lib.footermenu{
wrap = <ul>|</ul>
20 = HMENU
20 {
special = directory
# special.value will contain the page ID of the Footer menu page
special.value = 20
1 = TMENU
1 {
target = _self
NO {
allWrap = <li>|</li>
}
}
}
}

TYPO3 HMENU doesn't shows parent Level pages

I want to make a Header menu, witch should be static through all subpages. At Home page I have this typoscript and works fine
//this is a subpart
MENU_HEADER = COA
MENU_HEADER {
10 = HMENU
10 {
wrap = <ul>|</ul>
entryLevel = 0
1 = TMENU
1 {
//expAll = 1
target = _top
NO = 1
NO {
allWrap = <li class="list1">|</li>
stdWrap.innerWrap = <strong><img src="fileadmin/templates/img/header/menu-list1-icon.png" width="45px" height="50px;" alt=""></strong><span>|</span>
}
}
}
In my subpages I have the following typoscript code:
MENU_PAGES = COA
MENU_PAGES {
10 = HMENU
10 {
entryLevel = 0
wrap = <ul>|</ul>
1 = TMENU
1 {
//expAll = 1
//noBlur = 1
target = _top
NO = 1
NO {
stdWrap.htmlSpecialChars = 1
stdWrap.innerWrap = <span>|</span>
allWrap = <li class="list1">|
}
CUR = 2
CUR {
stdWrap.innerWrap = <span>|</span>
allWrap = <li class="list1 active">|
}
}
2 = TMENU
2 {
wrap = <ul class="dropdown">|</ul></li>
target = _top
NO {
wrapItemAndSub = <li>|</li>
}
CUR < .NO
CUR = 1
CUR {
allWrap = <li class="subactive">|</li>
}
ACT < .CUR
ACT = 1
}
}
}
In this second part, only subpages of the current page are shown in the menu. As I mentioned above I need all the parent pages and their child appear in my menu. I tried entryLevel = -1 but nothing happened!
This might be help you:
lib.navbar = COA
lib.navbar.wrap = <nav>|</nav>
lib.navbar {
special = directory
special.value = 1
1 = TMENU
1 {
wrap = <ul class="nav sf-menu">|</ul>
expAll = 1
NO = 1
NO.allWrap >
NO.wrapItemAndSub = <li>|</li>
ACT = 1
ACT < .NO
ACT.wrapItemAndSub = <li class="active">|</li>
CUR = 1
CUR < .NO
CUR.wrapItemAndSub = <li class="active">|</li>
}
2<.1
2.wrap = <ul class="submenu">|</ul>
}
This is the same as you want. on hover will display sub-pages of the current page if exist. you have to change wrapping as per your requirement.

TYPO3 first available image of content elements

I want to show only the first available image of different content elements in a column.
The following code shows me all available images, but I need only the first one!
Can somebody help me?
lib.contentImage = CONTENT
lib.contentImage {
wrap = |
table = tt_content
select {
languageField = sys_language_uid
where = colPos = 0
orderBy = sorting
pidInList = 32
}
renderObj = COA
renderObj{
wrap = <div class="item">|</div>
10 = FILES
10 {
references {
table = tt_content
uid.data = uid
fieldName = assets
}
renderObj = IMAGE
renderObj {
wrap = <div class="item-image">|</div>
file.import.data = file:current:originalUid
file.width = 1920c
file.height = 600c
}
}
}
}
I used this to get the url of the first image on a page for open graph tags.
page.meta.og:image.cObject = CONTENT
page.meta.og:image.cObject {
table = tt_content
select {
where = (colPos = 0 AND image != 0 )
selectFields = uid
orderBy = sorting
max = 1
}
renderObj = COA
renderObj {
1 = TEXT
1 {
cObject = FILES
cObject {
references {
table = tt_content
uid.field = uid
fieldName = image
}
maxItems = 1
renderObj = TEXT
renderObj {
typolink.parameter.data = file:current:publicUrl
typolink.forceAbsoluteUrl = 1
typolink.returnLast = url
}
}
}
}
}
page.meta.og:image.attribute = property
You would try somethings with LOAD_REGISTER
e.g.: (not tested)
lib.contentImage = COA
lib.contentImage {
5 = LOAD_REGISTER
5.imageRendered = 0
10 = CONTENT
10 {
wrap = |
table = tt_content
select {
languageField = sys_language_uid
where = colPos = 0
orderBy = sorting
pidInList = 32
}
renderObj = COA
renderObj{
wrap = <div class="item">|</div>
10 = FILES
10 {
references {
table = tt_content
uid.data = uid
fieldName = assets
}
max = 1
renderObj = COA
renderObj {
stdWrap.if.isFalse.data = register:imageRendered
5 = LOAD_REGISTER
5.imageRendered = 1
10 = IMAGE
10 {
wrap = <div class="item-image">|</div>
file.import.data = file:current:originalUid
file.width = 1920c
file.height = 600c
}
}
}
}
}
99 = RESTORE_REGISTER
}
Do you need the first one of each Contentelement or the first Image of all Contentelements?
If you only want one image for each element you can set maxItems in FILES Object https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Files/Index.html#usage-with-references

tt_products imageLinkWrap typolink title for each image

Iam using tt_products and trying to get a "title" param for each link to an Image, which is not provided from this extension. I have some free data-table fields left which id like to use to store the titles für each link.
This is how the Example has to look like in the Frontend after rendering each link and image.
This is the solution that i worked out till now, it loads the content from the fields but it dont split the conten of the field right and apend them to the right images
temp.imageLinkWrap = 1
temp.imageLinkWrap {
stdWrap = stdWrap
enable = 1
typolink {
parameter.cObject = IMG_RESOURCE
parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile
parameter.cObject.file.maxW = {$plugin.perfectlightbox.lightBoxMaxW}
parameter.cObject.file.maxH = {$plugin.perfectlightbox.lightBoxMaxH}
parameter.override.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
title >
title.override.cObject = COA
title.override.cObject {
10 = TEXT
10{
data {
data = GP:tt_products|product
intval = 0
wrap = DB:tt_products: | :image
}
split{
token = ,
cObjNum = 1
1.current = 1
# for each image, add the imagecaption
1.wrap = |
1.append = TEXT
1.append {
data {
data = GP:tt_products|product
intval = 1
wrap = DB:tt_products: | :quality
}
# split saves the index in REGISTER:SPLIT_COUNT
listNum.stdWrap.data = REGISTER:SPLIT_COUNT
listNum.splitChar = 10
}
}
}
}
title.override.if.isTrue = 1
title.insertData = 1
parameter.cObject = IMG_RESOURCE
parameter.cObject.file.import.data = TSFE:lastImageInfo|origFile
ATagParams >
ATagParams.cObject = COA
ATagParams.cObject {
10 = TEXT
10.value = rel="lightbox[lb{field:uid}]"
}
ATagParams.insertData = 1
}
}
plugin.tt_products {
templateFile = fileadmin/template/html/partial/ext/shop-tmpl.html
pid_list = 23
wrapInBaseClass = 0
requiredInfoFields = agb, name, address, zip, city, email
limitImageSingle = 6
separateImage = 1
listImage < .image
listImage.file.maxW = 300
listImage.file.maxH =
listImage.imageLinkWrap >
image.wrap = <div class="img_single"> | </div>
usePageContentImage = 0
imageLinkWrap = 1
image {
altText = TEXT
altText.data = field:title
imageLinkWrap >
imageLinkWrap < temp.imageLinkWrap
}
}

Typo3 max image size for content elements

I try to set the max image size for a specific content element. How can I do this for the element "content"? I tried to combine several options, but nothing works.
Is the content.maxImageWidthInText.maxH the right way?
Here is my code:
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
default = TEXT
default.value = fileadmin/templates/index.html
1 = TEXT
1.value = fileadmin/templates/index.html
}
variables {
# Content
content < styles.content.get
content.select.where = colPos=0
content.maxImageWidthInText.maxW = 135
.....
}
}
}
There are the registers maxImageWidth and maxImageWidthInText to do that:
content = COA
content {
10 = LOAD_REGISTER
10 {
maxImageWidth = 135
maxImageWidthInText = 100
}
20 < styles.content.get
30 = RESTORE_REGISTER
}
Couldn't find any official documentation though - you can find this stuff using the TypoScript object browser.

Resources