Based on that I've created a menu with dropdown submenu.
Page 1Page2Page3Page4Page5
Subpage1subpage1subpage1subpage1
Subpage2subpage2subpage2subpage2
Subpage3
So far everything is easy. Now, let say that after user
clicks on Page4 or its submenu items, the menu changes to:
Subpage1Subpage2Page 1Page2Page3Page5
Subsubpage1subsubpage1subpage1subpage1subpage1
Subsubpage2subsubpage2subpage2subpage2subpage2
Subsubpage3subpage3
As you can see, there is no longer Page4, there are only its
subpages, which moved into main menu level (subpages, written in BOLD). The
same thing happens when the user clicks on Page 5. I've got it working with »NOT
in the menu« - TRUE/FALSE, but it happend that I have four of those and it gets
pretty confused. I'm using 5 macros for that: one for FULL main menu, one for the main menu, when there is no Page4, one for Page4 menu, one for when there is not Page5 and one for Page5 menu. And then I just put them in different templates. Is there any easier way to do that?
Why do you want to remove the current parent page from the menu? This seems as though it would be very confusing for the user.
Maybe a more intuitive and efficient solution would be to two separate menus (sub and main), always show the main menu and show the submenu when appropriate. The XSLT for this would be a lot more straightforward than having to track which page the user is on and removing various pages and submenus.
How to create different menus with submenus?
Dear Umbraco users,
Here's my story. I have usual web page structure
HOME
Page 1 Page2 Page3 Page4 Page5
Subpage1 subpage1 subpage1 subpage1
Subpage2 subpage2 subpage2 subpage2
Subpage3
Based on that I've created a menu with dropdown submenu.
Page 1 Page2 Page3 Page4 Page5
Subpage1 subpage1 subpage1 subpage1
Subpage2 subpage2 subpage2 subpage2
Subpage3
So far everything is easy. Now, let say that after user clicks on Page4 or its submenu items, the menu changes to:
Subpage1 Subpage2 Page 1 Page2 Page3 Page5
Subsubpage1 subsubpage1 subpage1 subpage1 subpage1
Subsubpage2 subsubpage2 subpage2 subpage2 subpage2
Subsubpage3 subpage3
As you can see, there is no longer Page4, there are only its subpages, which moved into main menu level (subpages, written in BOLD). The same thing happens when the user clicks on Page 5. I've got it working with »NOT in the menu« - TRUE/FALSE, but it happend that I have four of those and it gets pretty confused. I'm using 5 macros for that: one for FULL main menu, one for the main menu, when there is no Page4, one for Page4 menu, one for when there is not Page5 and one for Page5 menu. And then I just put them in different templates. Is there any easier way to do that?
Here's the code (XSLT) - full main menu:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level = $level]/* [string(mainNavHide) != '1' and @isDoc]">
<xsl:choose>
<xsl:when test="@nodeName= 'Akcije'">
<li>
<a class="curtainIt drop" href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="(count(current()/* [string(mainNavHide) != '1' and @isDoc]) > 0)">
<div class="col_1 firstcolumn">
<ul class="levels">
<xsl:for-each select="current()/* [@isDoc]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/></a>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</li>
</xsl:when>
<xsl:otherwise>
<li>
<a class="drop" href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="(count(current()/* [string(mainNavHide) != '1' and @isDoc]) > 0)">
<div class="col_1 firstcolumn">
<ul class="levels">
<xsl:for-each select="current()/* [@isDoc]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/></a>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Main menu without Page4:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level = $level]/* [string(Page4NavHide) != '1' and @isDoc]">
<xsl:choose>
<xsl:when test="@nodeName= 'Akcije'">
<li>
<a class="curtainIt" href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="(count(current()/* [string(Page4NavHide) != '1' and @isDoc]) > 0)">
<ul>
<xsl:for-each select="current()/* [@isDoc]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:when>
<xsl:otherwise>
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="(count(current()/* [string(mainNavHide) != '1' and @isDoc]) > 0)">
<ul>
<xsl:for-each select="current()/* [@isDoc]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
And for Page4 menu:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="2"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level = $level]/* [string(subNavPage4Hide) != '1' and @isDoc]">
<xsl:choose>
<xsl:when test="@nodeName= 'Akcije'">
</xsl:when>
<xsl:otherwise>
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="(count(current()/* [string(mainNavHide) != '1' and @isDoc]) > 0)">
<ul>
<xsl:for-each select="current()/* [@isDoc]">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/></a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
For Page5 the macros are the same as the last two. Please, advice!!!
THX, Uros
Why do you want to remove the current parent page from the menu? This seems as though it would be very confusing for the user.
Maybe a more intuitive and efficient solution would be to two separate menus (sub and main), always show the main menu and show the submenu when appropriate. The XSLT for this would be a lot more straightforward than having to track which page the user is on and removing various pages and submenus.
is working on a reply...