Library · Code examples

Manual rendering of page menus

How to manually render page menus or treat specific page uids different from others in a menu

Description Manual rendering of page menus and different treatment for specific page uids
Author benjaminrau
Creation date 2014-08-27T12:19:17.000Z
Extensions
  1. FluidTYPO3.Fluidpages
  2. FluidTYPO3.Vhs
Tags
  1. Pages
  2. ViewHelpers
Files
  1. PageMenu.html
<div xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:section name="MainMenu">
<ul class="nav">
<v:page.menu pageUid="{settings.mainMenuRootPageUid}" entryLevel="2" levels="2" expandAll="TRUE" as="menu">
<f:for each="{menu}" as="item">
<v:switch value="{item.uid}">
<v:case case="{settings.pageUidToDoSmthElse}" break="TRUE">
<li class="{item.class} dropdown">
<a href="{item.link}" class="dropdown-toggle" data-toggle="dropdown">{item.linktext}</a>
<f:render partial="PageMenu/OtherTypeOfSubmenu" arguments="{_all}" optional="TRUE" />
</li>
</v:case>
<v:case case="default">
<f:if condition="{item.hasSubPages}">
<f:then>
<li class="{item.class} dropdown">
<a href="{item.link}" class="dropdown-toggle" data-toggle="dropdown">{item.linktext}</a>
<ul class="dropdown-menu">
<f:render section="Submenu" arguments="{_all}" />
</ul>
</li>
</f:then>
<f:else>
<li class="{item.class}">
<a href="{item.link}">{item.linktext}</a>
</li>
</f:else>
</f:if>
</v:case>
</v:switch>
</f:for>
</v:page.menu>
</ul>
</f:section>
<f:section name="Submenu">
<v:page.menu pageUid="{item.uid}" entryLevel="2" levels="1" as="submenu">
<f:for each="{submenu}" as="subitem">
<li class="{subitem.class}">
<a href="{subitem.link}">{subitem.linktext}</a>
</li>
</f:for>
</v:page.menu>
</f:section>
</div>
view raw PageMenu.html hosted with ❤ by GitHub