Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ed Collins 9 posts 29 karma points
    Aug 03, 2011 @ 18:07
    Ed Collins
    0

    Unable to hide nodes from navigation

    Not sure if this is a bug, more likely something I've changed that is causing the error.

    At the 4th level of the nodes in the site, when the umbracoNaviHide is checked, the nodes still show in the site navigation.

    I have not changed the XSLT in the Navigation.xslt file that was part of the package.

    Has anyone seen the same issue?

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 03, 2011 @ 20:22
    Fuji Kusaka
    0

    Hi Ed,

    Can you should us your XSLT code?....do you have the (umbracoNaviHide) != '1' in your XSLT?

     

    //fuji

  • Ed Collins 9 posts 29 karma points
    Aug 03, 2011 @ 20:28
    Ed Collins
    0

    Hey Fuji.

    Thanks for your response.

    There is code in the XSLT for it. I'm actually using the Koiak starter site, and the Navigation XSLT file is what controls it.

    I have not modified the XSLT. Is it possible some other factor is involved?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:Stylesheet [
    <!ENTITY nbsp "&#x00A0;">
    ]>
    <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"/>

    <xsl:variable name="CssClassName" select="/macro/CssClassName" />
    <xsl:variable name="CssId" select="/macro/CssId" />

    <xsl:variable name="StopLevel" select="/macro/StopLevel" />
    <xsl:variable name="StartLevel" select="/macro/StartLevel" />

    <xsl:template match="/">
    <xsl:call-template name="Navigation">
    <xsl:with-param name="childNodes" select="$currentPage/ancestor-or-self::*[@isDoc][@level=($StartLevel)]/*

    [@isDoc][not(name()='Article')][not(umbracoNaviHide=1)]" />
    </xsl:call-template>
    </xsl:template>

    <xsl:template name="Navigation">
    <xsl:param name="childNodes"/>
    <xsl:choose>
    <xsl:when test="count($childNodes) > 0">
    <ul>
    <xsl:if test="$CssId !=''">
    <xsl:attribute name="id">
    <xsl:value-of select="$CssId" />
    </xsl:attribute>
    </xsl:if>
    <xsl:if test="$CssClassName !=''">
    <xsl:attribute name="class">
    <xsl:value-of select="$CssClassName" />
    </xsl:attribute>
    </xsl:if>

    <xsl:for-each select="$childNodes">
    <xsl:call-template name="SubMenu"/>
    </xsl:for-each>
    </ul>
    </xsl:when>
    <xsl:otherwise>
    &nbsp;
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>


    <xsl:template name="SubMenu">
    <xsl:if test="(umbraco.library:IsProtected(current()/@id, current()/@path) = false() or

    (umbraco.library:HasAccess(current()/@id, current()/@path) = true() ))">
    <li>
    <xsl:attribute name="class">

    <xsl:if test="$currentPage/ancestor-or-self::*[@isDoc]/@id = current()/@id">
    <xsl:text>selected </xsl:text>
    </xsl:if>

    <xsl:if test="position() = 1">
    <xsl:text>first </xsl:text>
    </xsl:if>

    <xsl:if test="position() = last()">
    <xsl:text>last</xsl:text>
    </xsl:if>
    </xsl:attribute>
    <xsl:choose>
    <xsl:when test="string-length(data[@alias='RedirectUrl']) > 0">
    <a href="{data[@alias='RedirectUrl']}" title="{@nodeName}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </xsl:when>
    <xsl:when test="string-length(data[@alias='RedirectPageId']) > 0">
    <a href="{umbraco.library:NiceUrl(data[@alias='RedirectPageId'])}" title="{@nodeName}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </xsl:when>
    <xsl:otherwise>
    <a href="{umbraco.library:NiceUrl(@id)}" title="{@nodeName}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </xsl:otherwise>
    </xsl:choose>


    <xsl:if test="current()/@level &lt; ($StopLevel) and $currentPage/ancestor-or-self::*[@isDoc]/@id =

    current()/@id">
    <xsl:if test="count(*[@isDoc][not(data[@alias='umbracoNaviHide']!=1)]) > 0">
    <ul>
    <xsl:for-each select="*[@isDoc][not(data[@alias='umbracoNaviHide']=1)]">
    <xsl:sort select="@sortOrder" data-type="number" />
    <xsl:call-template name="SubMenu"/>
    </xsl:for-each>
    </ul>
    </xsl:if>
    </xsl:if>

    </li>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 03, 2011 @ 20:40
    Fuji Kusaka
    0

    Can you try changing

    <xsl:with-paramname="childNodes"select="$currentPage/ancestor-or-self::*[@isDoc][@level=($StartLevel)]/* 

    [@isDoc][not(name()='Article')][not(umbracoNaviHide=1)]"
    />

    to

    <xsl:with-paramname="childNodes"select="$currentPage/ancestor-or-self::* [@isDoc and @level = $StartLevel]/* [@isDoc and string(umbracoNaviHide) != '1']"/>
  • Ed Collins 9 posts 29 karma points
    Aug 03, 2011 @ 21:06
    Ed Collins
    0

    Thanks for the try, but same results.

    Some of the items in the tree will be hidden when the umbracoNaviHide is true. But, at the next level the node will not be hidden even though umbracoNaviHide is true for that node as well.

    For example, here is my tree:

    Content
     - Home
      - Products
       - Disability (last node that will hide. Also happens to be the first node shown in the left navigation.)
        - Revision
         - Product Guide (this is the node that I want to hide)

    Does that make any difference?

    I've tried republishing the site, and republishing at the Home level with all subpage and child pages checked so they publish also.

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 03, 2011 @ 21:13
    Fuji Kusaka
    0

    Ed, is it a mutilevel navigation or just a simple navigation where some nodes needs to be hidden?

  • Ed Collins 9 posts 29 karma points
    Aug 03, 2011 @ 21:22
    Ed Collins
    0

    Fuji, thanks again for your help.

    The same as the navigation on the sample Koiak web site:


     

    (http://our.umbraco.org/media/wiki/12479/634267496176800000_Standard-Site-Standard-Page-.png)

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 03, 2011 @ 21:29
    Fuji Kusaka
    0

    Ed, is Sub Navigation 1 a drop down menu under about us? If not you can give this code a try.

     

    <xsl:variable name="level" select="1"/>

        <xsl:template match="/">

          
     <ul id="topNavigation">
           <li >
             <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
                 <xsl:attribute name="class"> selected</xsl:attribute>
             </xsl:if>
             <a href="/">Home</a>
           </li>
          <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
         <xsl:if test="@id = $currentPage/@id">
            <xsl:attribute name="class">selected</xsl:attribute>
          </xsl:if>
        <href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
      </li> 
      
    </xsl:for-each>
    </ul>
  • Ed Collins 9 posts 29 karma points
    Aug 03, 2011 @ 22:52
    Ed Collins
    0

    Fuji,

    That moved the navigation links at the top of the page over to the side with the left nav items.

    I'm beginning to think that there is something in another file that I changed that is causing the issue. No idea what that could be.

    Or, the XSLT isn't designed to handle that many levels in the menu, is that possible?

    I appreciate all your help. If you think this may not be possible to fix this issue via forum talk, let me know.

    Ed

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 04, 2011 @ 03:27
    Fuji Kusaka
    0

    Hi Ed,

    Am still not very sure how your navigation works or should be working. Are you running under v4.7?

    Amyways, if you want more help on this spit it out, the umbraco community is there to help.

    //fuji

  • Ed Collins 9 posts 29 karma points
    Aug 04, 2011 @ 14:02
    Ed Collins
    0

    Fuji, here are a couple of screen caps that show the navigation in Umbraco and on the site.

    I've marked where the nodes are not hiding as they should when the umbracoNaviHide is true.

    On the site:

    Hope this helps.

    Ed

Please Sign in or register to post replies

Write your reply to:

Draft