typo3 - TypoScript menu, with special treatment for specific pageIDs contained in list -
tearing hair out on typoscript menu. need next behaviour:
a list of "special" menu items pageids maintained in constant {$special}
a hmenu rendered showing navigation of site root. if pageid "special", gets special div wrap, , list of kid pages nested within of div wrap. if item not "special", gets no special wrap, , no kid pages shown. "special" items shown @ top of page list.
i've tried couple of approaches:
approach 1. render 2 hmenus, 1 after other. first menu shows {$special}, sec menu shows siteroot, excluding {$special} items.
problem: if utilize special.directory show {$special}, parent pages not rendered. if utilize special.list, kid pages not rendered. argh!
approach 2. render big chunk of custom menu ts, using if conditions check if page {$special}
problem: can special wraps show on {$special} items, can't work out how render list of kid pages specific each item.
my code approach 2 is, far:
main_nav.20 = hmenu main_nav.20 { special = directory special.value = {$site_root} excludeuidlist = {$restricted_root}, {$home_shortcut} 1 = tmenu 1{ no{ # suppress standard menu output donotshowlink = 1 # build each menu item conditionally stdwrap2.cobject = coa stdwrap2.cobject{ #standard 10 = text 10{ # not in list of special pages? if.value = {$nav_containers} if.isinlist.field = uid if.negate = 1 field = nav_title//title typolink.parameter.field = uid wrap = <ul><li>|</li></ul> } #special 20 = text 20.wrap = <div class="special"><ul><li><span>|</span> 20 { if.value.field = uid if.equals = {$special} field = nav_title//title } 30 = text 30.wrap = |</li></ul></div> 30 { if.value.field = uid if.equals = {$special} } } } } } i can't hardcode (like "special item 1 text element, special item 1 children menu, special item 1 text element, special item 2 children...") because {$special} theoretically wind beingness number of pages.
can offer suggestions assist 1 or other approach?
i think user ila right, if utilize special = list, should able add together multiple levels (child pages) adding tmenus.
on other hand, i've got similar menu i'd share. contains 2 kinds of special rendering cases - 1 override.if , other 1 case.
temp.mainnav = hmenu temp.mainnav { wrap = <nav>|</nav> entrylevel = 0 1 = tmenu 1 { noblur = 1 expall = 1 wrap = <ul>|</ul> no { wrapitemandsub=<li class="p{page:uid}">|</li> wrapitemandsub.insertdata = 1 } } 2 = tmenu 2 { noblur = 1 expall = 1 no { wrapitemandsub=<li>|</li> // http://labor.99grad.de/2013/07/10/typo3-hmenu-einen-menupunkt-anders-darstellen/ donotlinkit.override = 1 donotlinkit.override.if { value = {$pidsdonotlinkinmenu} isinlist.field = uid } stdwrap.wrap.override = <p class="unlinkedmenuitem">|</p> stdwrap.wrap.override.if { value = {$pidsdonotlinkinmenu} isinlist.field = uid } } } 3 = tmenu 3 { noblur = 1 expall = 1 wrap = <ul class="level3">|</ul> no.wrapitemandsub.cobject = case no.wrapitemandsub.cobject { //http://stackoverflow.com/questions/18899573/how-to-apply-a-different-wrap-in-a-tmenu-for-certain-items-only/18910302?noredirect=1#18910302 key.field = uid // normal item default = text default.value = <li class="level3">|</li> // special item {$somepid} = text {$somepid}.value = <li class="level3 foo">|</li> {$somepid}.append < temp.sometemp // other special item {$someotherpid} = text {$someotherpid}.value = <li class="level3 bar">|</li> {$someotherpid}.append < temp.someothertemp } } } i think both approaches used accomplish goal.
typo3 typoscript
No comments:
Post a Comment