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
The headmenu XML example:
And dropdownmenu example:
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.