The "current" class is not applied in the home page
This starter kit is better than the Runaway one and I like it.
Just found a small problem:
In the file \xslt\topNavigation.xslt, the the following bold code seems don't work well:
<li> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <xsl:attribute name="class">current</xsl:attribute> </xsl:if> <!-- NiceUrl takes a node ID and gives us a 'nice url' to the page --> <a href="{umbraco.library:NiceUrl($homePageNode/@id)}"> <xsl:value-of select="$homePageNode/@nodeName" /> </a> </li>
When the home page is the current page, the output html should be: <li class="current"><a
href="/home.aspx">Home</a></li>
But the code is aways like this: <li><a href="/home.aspx">Home</a></li>
I hope the user can see what page is the current page, but the home page is not highlighted when the home page is the current page.
<!-- Find the homepage (the topmost node in this tree section, with a doctype alias of 'homepage') --> <xsl:variable name="homePageNode" select="$currentPage/ancestor-or-self::root/node [@nodeTypeAlias='Homepage']" />
<ul class="nav"> <!-- we can assume that we'll need a homepage link in this nav --> <li> <xsl:if test="$homePageNode/@id = $currentPage/@id"> <xsl:attribute name="class">current</xsl:attribute> </xsl:if> <!-- NiceUrl takes a node ID and gives us a 'nice url' to the page --> <a href="{umbraco.library:NiceUrl($homePageNode/@id)}"> <xsl:value-of select="$homePageNode/@nodeName" /> </a> </li>
<!-- this loop takes all of the direct children of the homepage that aren't currently hidden --> <xsl:for-each select="$homePageNode/node [string(./data [@alias='umbracoNaviHide']) != '1']">
<li> <!-- a test to set the class of the link to the current page to 'current'
basically it says: If the current page or one if its parents has a node id equal to the id of the current page, set class to current --> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <xsl:attribute name="class">current</xsl:attribute> </xsl:if> <a href="{umbraco.library:NiceUrl(current()/@id)}"> <xsl:value-of select="current()/@nodeName" /> </a> </li>
Thanks for your work. The class works well for the Home link now. I think this start kit may have a more general name because this starter kit can be applied to most senarios, not only for business websites. You are the best.
The "current" class is not applied in the home page
This starter kit is better than the Runaway one and I like it.
Just found a small problem:
In the file \xslt\topNavigation.xslt, the the following bold code seems don't work well:
<li>
<xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<!-- NiceUrl takes a node ID and gives us a 'nice url' to the page -->
<a href="{umbraco.library:NiceUrl($homePageNode/@id)}">
<xsl:value-of select="$homePageNode/@nodeName" />
</a>
</li>
When the home page is the current page, the output html should be:
<li class="current"><a href="/home.aspx">Home</a></li>
But the code is aways like this:
<li><a href="/home.aspx">Home</a></li>
I hope the user can see what page is the current page, but the home page is not highlighted when the home page is the current page.
Hi Kevin
Thanks for the heads-up. Here is the updated xslt file. This package is due a revamp for 4.1, so I'll address this then.
Dan
Dan,
Thanks for your work. The class works well for the Home link now. I think this start kit may have a more general name because this starter kit can be applied to most senarios, not only for business websites. You are the best.
Kevin
Dan,
I was just about to post a new topic with this same question when I noticed that you answered it here.
Thanks!
I agree with Kevin: this is a great starter kit.
--steve
is working on a reply...