tt_news in Menu - typo3

In need to create a special and complicated menu. It should display in the Level 2 all sub-page with the latest news of their parent page (level 1) (I used tt_news and I created news for each page level 1). Here is my source code, it is composed of two parts, it shows in all level2 menu juste only the news of the first parent page(level 1).
The first part:
lib.var1 < plugin.tt_news
lib.var1 {
code >
code = LATEST
templateFile= fileadmin/news_template.tmpl
categoryMode = 0
pid_list >
pid_list.insertData = 1
pid_list = {data:pid}
catImageMode = 1
catTextMode = 0
latestLimit = 1
}
The second part:
lib.field_menu= HMENU
lib.field_menu {
entryLevel = 0
### first level ###
1 = TMENU
1 {
noBlur = 1
expAll = 1
wrap = |
NO = 1
NO {
allWrap = |
ATagTitle.field = title
}
}
### secondary Level ###
2 = TMENU
2 {
noBlur = 1
stdWrap.wrap = <ul style=""><li> | </li></ul>
stdWrap.innerWrap = <div><ul>|</ul></div>
stdWrap.innerWrap2.preCObject =< lib.var1
NO = 1
NO {
linkWrap= <li class="">|</li>
ATagTitle.field = title
}
}
}
}

Try:
pid_list >
pid_list = TEXT
pid_list.insertData = 1
pid_list.data = field : pid
instead if {data:pid}.

Related

TYPO3 - get last element of a splitted string

Trying to get the last part of the url as a body class. So far I got the slug of the page and split it by /
page.bodyTag >
page.bodyTagCObject = TEXT
page.bodyTagCObject.field = slug
page.bodyTagCObject.split {
token = /
cObjNum = 1
1.10 = TEXT
1.10.current = 1
1.10.noTrimWrap = | ||
1.10.dataWrap = |
1.10.required = 1
}
With this code, I am getting:
url: page/foo/bar/
class="page foo bar"
I need to get class="bar"
You'll need to use optionSplit for that. For example:
lib.test = TEXT
lib.test {
value = 1,2,3,4
split {
token = ,
cObjNum = 1 |*| 2 |*| 3
1 = TEXT
1 {
current = 1
wrap = First item:|<br/>
}
2 = TEXT
2 {
current = 1
wrap = Middle item:|<br/>
}
3 = TEXT
3 {
current = 1
wrap = Last item:|<br/>
}
}
}
1 |*| 2 |*| 3 means: use 1 for the first item, 3 for the last item and 2 for the rest.
You can just not set the ones you don't want, so this will only show the last item:
cObjNum = 1 |*| 1 |*| 2
2 = TEXT
2 {
current = 1
wrap = Last item:|<br/>
}

Typo3: Output of all 2nd level pages as menu independent of active pages

I want to create a menu of all 2nd level items at once in separate DIVs (outside the first level menu) - independent of the active page. Do you have an hint for me? Thank you very much for your help!!
don't forget to configure
1.expAll = 1
in your typoscript menu definition
I think you are looking something like this:
lib.menu = COA
lib.menu {
# Menu of first Level
10 = HMENU
10.entryLevel = 0
10.1 = TMENU
10.1.wrap = <ul> | </ul>
10.1.NO.allWrap = <li>|</li>
# Menu of all second levels
20 = HMENU
20.entryLevel = 0
20.1 = TMENU
20.1.expAll = 1
20.1.NO.doNotLinkIt = 1
20.1.NO.doNotShowLink =1
20.1.IFSUB = 1
20.1.IFSUB.doNotLinkIt = 1
20.1.IFSUB.allWrap = <h4>2°lv (|) </h4>
20.2 = TMENU
20.2.wrap = <ul> | </ul>
20.2.NO.allWrap = <li> | </li>
}
Thank you for your answers! I found a similar solution like the one Cristian Buja posted, that works fine for me. Here's the code if someone have the same issue: `lib.subnav = HMENU
lib.subnav {
1 = TMENU
1 {
expAll = 1
NO.doNotShowLink = 1
IFSUB = 1
IFSUB.doNotShowLink = 1
IFSUB.allWrap = <div id="s{elementUid}" class="nv-sub-wrapper"><div class="nv-sub-menu clearfix">|
IFSUB.wrapItemAndSub = |<div class="nv-sub-info"></div></div></div>
IFSUB.subst_elementUid = 1
}
2 = TMENU
2 {
wrap = <ul>|</ul>
NO = 0
NO {
ATagParams = data-description="{field:abstract // field:subtitle // field:title}"
ATagParams.insertData = 1
wrapItemAndSub = <li>|</li>
}
}
}`

TYPO3 mark root page as active

In my TYPO3 6.2.31 (I know...) page I have the following typoscript for the navigation:
NAVIMAIN = HMENU
NAVIMAIN.entryLevel = 0
#NAVIMAIN.excludeUidList =
NAVIMAIN {
1 = TMENU
1 {
expAll = 1
wrap = <ul class="sf-menu">|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.wrapItemAndSub = <li>|</li>
ACT = 1
ACT.wrapItemAndSub = <li class="active"> |</li>
}
2 = TMENU
2 {
expAll = 1
maxItems = 10
wrap = <div class="sf-mega">|</div>
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <div class="sf-mega-section">|</div>
stdWrap.wrap = |
ATagParams = class="headermega"
stdWrap.htmlSpecialChars = 1
doNotLinkIt = 0
}
}
3 = TMENU
3 {
expAll = 1
maxItems = 20
wrap = <ul>|</ul>
NO = 1
NO {
ATagTitle.field = title
linkWrap = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li>|</li>
ATagParams = class="active"
}
}
#4 < .3
}
All sub pages are marked as aktive when they are clicked ... but the root node not ... so I've added this as well:
[globalVar = TSFE:id=1]
NAVIMAIN.alwaysActivePIDlist = 1
[global]
[globalVar = TSFE:id=1]
NAVIMAIN.alwaysActivePIDlist = 60
[global]
But this does hasn't any effect as well.
What can I do to mark the root node as active as well?
Thanks in advance
After some Teamviewer investigations we found the source of the problem in the Typoscript structure. The [globalVar] condition was placed inside page.20.marks {} but conditions must be placed outside of any nesting.
Moving the condition outside of the nesting and correcting the path, everything worked fine.
[globalVar = TSFE:id=1]
page.20.marks.NAVIMAIN.alwaysActivePIDlist = 60
[global]
As Bernd said, [page:uid = 1] would be the better condition, too.
If you want both pages to be active you need to do another construct as in your way the second assignement would overwrite the first one.
[globalVar = TSFE:id=1]
NAVIMAIN.alwaysActivePIDlist := addToList(1)
[global]
[globalVar = TSFE:id=1]
NAVIMAIN.alwaysActivePIDlist := addToList(60)
[global]
In general you would join the two statements.
Another change I would consider: use another condition as TSFE will become obsolete in the near future:
[page:uid = 1]
NAVIMAIN.alwaysActivePIDlist = 1,60
[global]

TYPO3 multilanguage preview not showing second language

I've got a TYPO3 page with two languages the default one and english.
Now when I press the view button on the secondary language to get the prview page with the URL www.domain.de/home/?L=2. But the page is the german version and not the english one?
I'm using realurl could that be the problem?
Update Typoscript
#xhtml_cleaning = all damit wird mit "/" ausgegeben
uniqueLinkVars = 1
linkVars = L(1-3)
sys_language_uid = 0
sys_language_overlay = hideNonTranslated
sys_language_mode = content_fallback
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
intTarget = _self
extTarget = _blank
}
and this
CONTENTMAIN = CONTENT
CONTENTMAIN.table = tt_content
CONTENTMAIN.select.where = colPos = 0
CONTENTMAIN.select.languageField = sys_language_uid
CONTENTMAIN.select.orderBy = sorting
UPDATE:
actual full Typoscript (setup)
# Responsive Design Optimization
tt_content.image.20 {
imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap1"> | </div>
imageColumnStdWrap.dataWrap = <div class="csc-textpic-imagecolumn"> | </div>
}
tt_content.image.20 {
rendering {
dl {
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow"> | </div>
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last"> | </div>
oneImageStdWrap.dataWrap = <dl class="csc-textpic-image###CLASSES###" > | </dl>
}
ul {
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow"><ul> | </ul></div>
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last"><ul> | </ul></div>
oneImageStdWrap.dataWrap = <li class="csc-textpic-image###CLASSES###"> | </li>
}
div {
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow"> | </div>
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last"> | </div>
oneImageStdWrap.dataWrap = <div class="csc-textpic-image###CLASSES###"> | </div>
}
simple {
imageStdWrap.dataWrap = <div class="csc-textpic-imagewrap csc-textpic-single-image"> | </div>
}
}
}
tt_content.image.20 {
renderMethod = figure
rendering {
figure {
imageRowStdWrap.dataWrap = <div class="csc-textpic-imagerow"> | </div>
imageLastRowStdWrap.dataWrap = <div class="csc-textpic-imagerow csc-textpic-imagerow-last"> | </div>
noRowsStdWrap.wrap =
oneImageStdWrap.dataWrap = <figure class="csc-textpic-image"> | </figure>
imgTagStdWrap.wrap = |
editIconsStdWrap.wrap = <div> | </div>
caption.wrap = <figcaption> | </figcaption>
caption.required = 1
}
}
}
#CONFIGURATION####################
[globalVar = GP:L = 2]
config {
sys_language_uid = 2
language = en
locale_all = en_US.UTF-8
htmlTag_langKey = en
}
[global]
config {
# headerComment (
#Diese Seite wurde erstellt von:
#DeWo Werbeagentur OHG
#Zuständig für Layout-Umsetzung
#dewo.de
#)
doctype = html5
renderCharset = utf-8
metaCharset = utf-8
prefixLocalAnchors = all
simulateStaticDocuments = 0
tx_realurl_enable = 1
absRefPrefix = /
spamProtectEmailAddresses = 2
spamProtectEmailAddresses_atSubst = (at)
// Cache settings
cache_period = 43200
#Entfernt Kommentare um die content elements
disablePrefixComment = 1
index_enable = 1
removeDefaultJS = external
admPanel = 1
sendCacheHeaders = 1
#xhtml_cleaning = all damit wird mit "/" ausgegeben
uniqueLinkVars = 1
linkVars = L(1-3)
sys_language_uid = 0
sys_language_overlay = hideNonTranslated
sys_language_mode = content_fallback
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
intTarget = _self
extTarget = _blank
}
page = PAGE
page {
typeNum = 0
shortcutIcon = fileadmin/bilder/favicon.png
appletouchicon =
insertClassesFromRTE = 1
adminPanelStyles = 1
# The meta Tags for the page.
meta {
# Description - auslesen und ggf. vererben wenn kein entry auf single page
description.data = page:description
description.ifEmpty.data = levelfield :-1, description, slide
# Keywords - auslesen und ggf. vererben wenn kein entry auf single page
keywords.data = page:keywords
keywords.ifEmpty.data = levelfield :-1, keywords, slide
keywords.keywords = 1
date.data = page:SYS_LASTCHANGED // page:crdate;
date.date = Y-m-d
author =
publisher =
copyright =
PAGE-TOPIC = Information
PAGE-TYPE = Information
language.data = TSFE:lang
robots = index, follow
siteinfo = robots.txt
revisit-after = 7 days
viewport = width = device-width, initial-scale=1.0
}
includeJSlibs {
jquery = fileadmin/config/script/js/jquery-1.11.1.min.js
jquery.forceOnTop = 1
}
includeCSS {
#a standard Grid system based on the boilertemplate
boil = fileadmin/config/script/css/boilerplate.css
boil.media = screen
boil.forceOnTop = 1
# our own navigation stylesheet
mefish = fileadmin/config/script/css/megafish.css
mefish.media = only screen and (min-width: 768px)
mefish.forceOnTop = 0
# Grid file based on the boilertemplate
grid = fileadmin/config/script/css/grid.css
grid.media = screen
grid.forceOnTop = 0
# our own stylesheet
flex = fileadmin/config/script/css/flexslider_styles.css
flex.media = screen
flex.forceOnTop = 0
# icon font
awe = fileadmin/config/script/font-awesome-4.0.3/css/font-awesome.min.css
awe.media = screen
awe.forceOnTop = 0
# IndexSearch Template
indexSearch = fileadmin/customDesign/indexsearch/css/indexsearch-style.css
indexSearch.media = screen
indexSearch.forceOnTop = 0
}
}
# END Page object
# blendet Subnavi aus,
[globalVar = TSFE:page|layout = 1]
page.includeCSS {
subnav = fileadmin/config/script/css/subnavi.css
subnav.media = screen
subnav.forceOnTop = 0
}
[global]
)
page.20 = TEMPLATE
page.20.template = FILE
page.20.template.file = fileadmin/config/script/template/template.html
page.20 {
workOnSubpart = DOCUMENT
marks {
#links
INHALTOBEN = CONTENT
INHALTOBEN.table = tt_content
INHALTOBEN.select.where = colPos = 1
INHALTOBEN.select.languageField = sys_language_uid
INHALTOBEN.select.orderBy = sorting
#normal
CONTENTMAIN = CONTENT
CONTENTMAIN.table = tt_content
CONTENTMAIN.select.where = colPos = 0
CONTENTMAIN.select.languageField = sys_language_uid
CONTENTMAIN.select.orderBy = sorting
#rechts
CONTENTASIDE = CONTENT
CONTENTASIDE.table = tt_content
CONTENTASIDE.select.where = colPos = 2
CONTENTASIDE.select.languageField = sys_language_uid
CONTENTASIDE.select.orderBy = sorting
#rand
OBEN = CONTENT
OBEN.table = tt_content
OBEN.select.where = colPos = 3
OBEN.select.languageField = sys_language_uid
OBEN.select.orderBy = sorting
#Hier in Zeile 220 die id von der Seite 'static' eingeben (Änderung 15.05.14 Florian Kasischke)
#NAVISTATIC = HMENU
#NAVISTATIC.special = directory
#NAVISTATIC.special.value =
#NAVISTATIC.excludeUidList = ,
#NAVISTATIC {
#1 = TMENU
#1 {
#expAll = 1
#wrap = <ul class="headernavmenu">|</ul>
#noBlur = 1
#NO = 1
#NO.ATagTitle.field = title
#NO.wrapItemAndSub = <li>|</li>
#NO.allWrap = | I |*| | I |*| |
#ACT < .NO
#ACT.ATagParams = class="active_static"
#}
#}
BREAD = HMENU
BREAD {
special = rootline
special.range = 0 | 2
1 = TMENU
1.NO.ATagTitle.field = title
1.NO.ATagParams = class="staticbread"
1.NO.allWrap = | / |*| | / |*| |
}
NAVIMAIN = HMENU
NAVIMAIN.entryLevel = 0
#NAVIMAIN.excludeUidList =
NAVIMAIN {
1 = TMENU
1 {
expAll = 1
wrap = <ul class="sf-menu">|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.wrapItemAndSub = <li>|</li>
ACT = 1
ACT.ATagParams = class="act"
ACT.wrapItemAndSub = <li> |</li>
}
2 = TMENU
2 {
expAll = 1
maxItems = 10
wrap = <div class="sf-mega">|</div>
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <div class="sf-mega-section">|</div>
stdWrap.wrap = |
ATagParams = class="headermega"
stdWrap.htmlSpecialChars = 1
doNotLinkIt = 0
}
}
3 = TMENU
3 {
expAll = 1
maxItems = 20
wrap = <ul>|</ul>
NO = 1
NO {
ATagTitle.field = title
linkWrap = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li>|</li>
ATagParams = class="active"
}
}
#4 < .3
}
NAVIOFF = HMENU
NAVIOFF.entryLevel = 0
#NAVIOFF.excludeUidList =
NAVIOFF {
1 = TMENU
1 {
expAll = 1
wrap = <ul class="sf-menu">|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.wrapItemAndSub = <li>|</li>
IFSUB = 1
IFSUB < .NO
IFSUB.ATagParams = class="pfeile"
ACT = 1
ACT < .NO
ACT.ATagParams = class="menuakt"
CUR = 1
CUR < .ACT
}
2 < .1
2.wrap = <ul>|</ul>
2.NO.wrapItemAndSub = <li class="first"> |</li> |*| <li> |</li> |*| <li class="last"> | </li>
2.ACT = 0
3 < .2
4 < .2
}
SUBNAVI = HMENU
SUBNAVI.entryLevel = 1
SUBNAVI.excludeUidList = 3,754,68
SUBNAVI {
1 = TMENU
1 {
expAll = 1
wrap = <ul>|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.ATagParams = style="border-bottom:2px solid rgba(255, 255, 255, 0.8);"
NO.wrapItemAndSub = <li>|</li>
IFSUB = 1
IFSUB < .NO
#IFSUB.stdWrap.dataWrap=| ▾
#▾
#IFSUB.ATagParams = class="pfeile"
ACT < .NO
ACT.ATagParams = class="subactive"
#IFSUB = 1
# IFSUB.wrapItemAndSub = <li class="menuparent">|</li>
#ACTIFSUB < .IFSUB
# wenn unterseiten vorhanden, dann kann Icon angezeigt werden
# IFSUB = 1
# IFSUB.stdWrap.dataWrap=» |
}
2 < .1
2 {
expAll = 0
}
3 < .2
3 = TMENU
3 {
expAll = 1
NO.ATagParams = style="padding-left:1.5rem;font-size:0.875rem;"
ACT < .NO
ACT.ATagParams = class="subactive" style="padding-left:1.5rem;font-size:0.875rem;"
}
#4 < .3
}
}
}
## Localization menu:
lib.langMenu = HMENU
lib.langMenu {
special = language
special.value = 0,1,2
special.normalWhenNoLanguage = 0
1 = GMENU
1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
5 = IMAGE
5.file = EXT:cms/tslib/media/flags/flag_uk.gif || EXT:cms/tslib/media/flags/flag_de.gif
5.offset = 2,2
}
1.ACT < lib.langMenu.1.NO
1.ACT=1
1.ACT.backColor = black
1.USERDEF1 < lib.langMenu.1.NO
1.USERDEF1=1
1.USERDEF1.5.file = EXT:cms/tslib/media/flags/flag_uk.gif || EXT:cms/tslib/media/flags/flag_de.gif
1.USERDEF1.noLink = 0
1.USERDEF2 < lib.langMenu.1.USERDEF1
1.USERDEF2.backColor = green
}
You need to include configuration that changes the language depending on the value of the L parameter:
config {
sys_language_uid = 0
language = de
locale_all = de_DE.UTF-8
htmlTag_langKey = de
}
[globalVar = GP:L = 2]
config {
sys_language_uid = 2
language = en
locale_all = en_US.UTF-8
htmlTag_langKey = en
}
[global]
Repeat this for all the languages with the accordant language ID (uid of the language record).
EDIT: The conditional block should be below the default block for language 0; added that.
You have the condition for language switch at the top of your typoscript. Later you override the config.sys_language_uid with the default value of 0.
So you have to put your condition at the bottom of your typoscript.

get Image from Pageproperties into an HMENU

I have an HMENU in Typo3, in the Pageproperties i have stored an image. How can i show the Image from the Pageproperties in ne Menu? I have no Idea, why the image is not displayed.
Typo3 6.2
lib.produkt_start = HMENU
lib.produkt_start {
special = directory
special.value = 3
wrap = |
1 = TMENU
1 {
expAll = 1
NO = 1
NO {
allWrap = <div class="patterns col4" id="page_{field:uid}">|</div>
allWrap.insertData = 1
ATagParams = id="uid{field:uid}"
ATagParams.insertData = 1
stdWrap.cObject >
stdWrap.cObject = COA
stdWrap.wrap = |
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap = <br /><h2>|</h2>
10.insertData = 1
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia-1, slide
30.treatIdAsReference = 1
30.import.listNum = 0
30.wrap = <h5>|</h5>
}
}
ACT = 1
ACT < .NO
}
}
I tested your problem with TYPO3 6.1.7
First of all you have to correct you code a little:
[...]
stdWrap.cObject {
10 = TEXT
10.field = title
10.wrap = <br /><h2>|</h2>
10.insertData = 1
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia:-1, slide
30.file.treatIdAsReference = 1
30.file.import.listNum = 0
30.wrap = <h5>|</h5>
}
[...]
Now it will be "working" but only if you actually set an image in media field of the parent page, then it will be renderd in all child pages, ignoring the fact that the child pages have an own image set - I would consider this as sort of a bug of TMENU or TMENUITEM, but I haven't realy testet it fully.
You will get a problem with entity encoding of the title as well so I would try this option:
stdWrap.wrap.cObject = COA
stdWrap.wrap.cObject {
10 = TEXT
10.value = <br><h2>|</h2>
20 = TEXT
20.wrap = <p><span>|</span></p>
20.field = subtitle
30 = IMAGE
30.file.import.data = levelmedia:-1, slide
30.file.treatIdAsReference = 1
30.file.import.listNum = 0
}
Strange is that the following does not work either:
30.file.import.field = media
This makes my suspition of the wrong slide behaviour above being a bug even stronger.