6 users online. Create an account or sign in to join them.Users
making navigation
This is an open discussion with 2 replies, filed under XSLT.
Search
Why not just use symphony’s default navigation datasource with the Recursive Navigation utility?
I’d try the following:
<ul id="headmenu">
<xsl:apply-templates select="entry[not(parent/item)]" mode="parent" />
</ul>
<xsl:template match="entry" mode="parent">
<li><xsl:value-of select="title" />
<ul class="dropdown" id="menu-{link/handle}">
<xsl:apply-templates select="../entry[parent/item/@id = current()/@id]" mode="child" />
</ul>
</li>
</xsl:template>
<xsl:template match="entry" mode="child">
<li><xsl:value-of select="title" /></li>
</xsl:template>
The magic happens in lines 2 (select all entries that do not have a parent) and 8 (select all entries that have a parent with the id equal to the current node).
miathrom: I do not like the quality of the Recursive Navigation templates.
Create an account or sign in to comment.
Hey there. I’ve been trying to make a dropdown menu for my site. There’s two sections - headmenu and dropdown. headmenu is the main section and dropdown is subsections to dropdown.
I’ve been to trying to make something like this
<ul id="headmenu"> <li> entry <ul class="dropdown" id="someid"> <li>entry <ul class="dropdown"> <li>entry</li> <li>entry</li> </ul> </li> </ul> </li> </ul>The headmenu XML example:
And dropdownmenu example:
<entry id="102"> <parent> <item id="99" handle="pakalpojumi" section-handle="headmenu" section-name="headmenu">Pakalpojumi</item> </parent> <link handle="service-kanalizacijas-sistemas">service/kanalizacijas-sistemas/</link> <title handle="kanalizacijas-sistemas">Kanaliz?cijas sist?mas</title> </entry>The only thing is - I can’t think how to write the XSLT code to make it right. Could somebody help, please? Sorry for my bad English, hope you could understand me :D Thank you already.