Copied to clipboard

Flag this post as spam?

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


  • Dwayne A 97 posts 117 karma points
    Mar 02, 2011 @ 15:29
    Dwayne A
    0

    umbracoNaviHide not hiding

    Hi,

    I've double-checked my checkbox property name "umbracoNaviHide", and the umbraco.config is setting the page to <umbracoNaviHide>1</umbracoNaviHide>. I've even deleted the config file, and still the page is not hidden.

    Have an xslt generating the menu. Could there be a conflict arising here, allowing the browser to show the page link even though it is hidden in the config?

  • Kim Andersen 1447 posts 2197 karma points MVP
    Mar 02, 2011 @ 15:45
    Kim Andersen
    0

    Hi Dwayne

    Did you use the default build in XSLT template for your navigation? I think it could be a lot easier to help if you could provide us with the XSLT code you are using to render the navigation. Thanks.

    /Kim A

  • Dwayne A 97 posts 117 karma points
    Mar 02, 2011 @ 15:53
    Dwayne A
    0

    Davs Kim,

    Yeah, code helps. Just thought I'd throw out the question first. Maybe it's something simple. Anyway, I am checking hidden docs: [not(&hidden;)]

     

        <xsl:template match="/">
          <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::* [@level=1]" />
              
          <xsl:variable name="mainMenuItems" select="$siteRoot /* [@isDoc] [not(&hidden;)]"></xsl:variable>
            <ul class="nav" id="nav-level1">
              <xsl:apply-templates select="$mainMenuItems" />
            </ul>
        </xsl:template>

        <xsl:template name="ShowMenuItem" match="*">
            <xsl:variable name="isCurrent" select="@id = $currentPage/ancestor-or-self::* /@id" />
            <li>
              <xsl:if test="$isCurrent">
                <xsl:attribute name="class">
                  <xsl:text>current</xsl:text>
                </xsl:attribute>
                </xsl:if>
                <a href="{umbraco.library:NiceUrl(@id)}">
                    <xsl:value-of select="@nodeName"/>
                </a>
              <xsl:variable name="subPages" select="./* [@isDoc] [not(&hidden;)]" />
                <xsl:if test="$isCurrent and $subPages">
                  <ul class="nav" id="nav-level2">
                      <xsl:apply-templates select="$subPages" />
                    </ul>
                </xsl:if>
            </li>
          </xsl:template>
  • Kim Andersen 1447 posts 2197 karma points MVP
    Mar 02, 2011 @ 15:58
    Kim Andersen
    0

    Could you try this instead:

    <xsl:template match="/">
          <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::* [@level=1]" />
               
          <xsl:variable name="mainMenuItems" select="$siteRoot /*[@isDoc and string(umbracoNaviHide) != '1']"></xsl:variable>
            <ul class="nav" id="nav-level1">
              <xsl:apply-templates select="$mainMenuItems" />
            </ul>
        </xsl:template>

        <xsl:template name="ShowMenuItem" match="*[@isDoc and string(umbracoNaviHide) != '1']">
            <xsl:variable name="isCurrent" select="@id = $currentPage/ancestor-or-self::* /@id" />
            <li>
              <xsl:if test="$isCurrent">
                <xsl:attribute name="class">
                  <xsl:text>current</xsl:text>
                </xsl:attribute>
                </xsl:if>
                <a href="{umbraco.library:NiceUrl(@id)}">
                    <xsl:value-of select="@nodeName"/>
                </a>
              <xsl:variable name="subPages" select="./* [@isDoc and string(umbracoNaviHide) != '1']" />
                <xsl:if test="$isCurrent and $subPages">
                  <ul class="nav" id="nav-level2">
                      <xsl:apply-templates select="$subPages" />
                    </ul>
                </xsl:if>
            </li>
          </xsl:template>

    Does that make a difference?

    I can see that you are using an entity called "hidden", could you maybe show us this as well, if the above doesn't work.

    /Kim A

  • Dwayne A 97 posts 117 karma points
    Mar 02, 2011 @ 16:11
    Dwayne A
    0

    Works like a charm, Kim ;~) Thanks. Not sure what you mean by "show you the entity"? I had some help creating that script, and as far as I recall there are no created entities. Where would they be created?

    I was looking on W3C and could not locate hidden. It appears you simply substituted this with

    and string(umbracoNaviHide) != '1'

    correct?

  • Dwayne A 97 posts 117 karma points
    Mar 02, 2011 @ 16:14
    Dwayne A
    0

    Wait! I did create that entity and forgot about it. DOH!

    <!DOCTYPE xsl:stylesheet [
        <!ENTITY nbsp "&#x00A0;">
        <!ENTITY hidden "data[@alias = 'umbracoNaviHide'] = 1">
    ]>

    Not sure why it prevents the pages from hiding. Any clue on your end?

  • Kim Andersen 1447 posts 2197 karma points MVP
    Mar 02, 2011 @ 16:15
    Kim Andersen
    0

    Yeah that's correct.

    I thought that you where using some kind of entity since you where reffering &hidden; which might contain the umbracoNaviHide, or something like that. If this doesn't make any sense to you don't mind :)

    Anyway, I'm glad you got it working.

    /Kim A

  • Kim Andersen 1447 posts 2197 karma points MVP
    Mar 02, 2011 @ 16:17
    Kim Andersen
    0

    Ahh cool enough. The entity you created are created for the legacy XML schema I see.

    You could try changing this:

    <!ENTITY hidden "data[@alias = 'umbracoNaviHide'] = 1">

    to something like this:

    <!ENTITY hidden "umbracoNaviHide = 1"> or this <!ENTITY hidden "string(umbracoNaviHide) = 1">

    Not sure if this works, but it might be worth a try :)

    /Kim A

  • Dwayne A 97 posts 117 karma points
    Mar 02, 2011 @ 16:27
    Dwayne A
    0

    Cool. I created that entity at an early developmental stage because my menu was not presenting any links. The entity helped initially, before I learned I need to initialize umbracoNaviHide by setting the property on a docType so the xslt can run properly. Was not certain that &hidden; was a call to it. Now the pieces are falling into place.

    I'm glad to have it cleared up, and changing the legacy will most likely allow that script to run. But I think the change you provided is cleaner. Still nice to know. Learned something new.

  • Dwayne A 97 posts 117 karma points
    Mar 02, 2011 @ 16:30
    Dwayne A
    0

    I tested the entity that corresponds with the new XML schema and that did the trick. Both methods work, but I'm checking the entity change as a solution, as that was the initial problem. Thanks for the help Kim!

  • Kim Andersen 1447 posts 2197 karma points MVP
    Mar 02, 2011 @ 16:48
    Kim Andersen
    1

    Cool! Great to hear that the entity trick worked as well :)

    /Kim A

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies