Copied to clipboard

Flag this post as spam?

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


  • newbie 13 posts 33 karma points
    Feb 20, 2012 @ 18:52
    newbie
    0

    Creating Navigation which is not based on content node name.

    Hi, im new to the whole xslt navigation creation, and i am simply wondering whether there is the ability to create a navigation off a spefied field name rather than the content node name??

    i current have this

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '2']">

    Creating a navigation for the second tier of nodes in my content,

    What i would like is the ability to have a navigation which is created from a property called "Section Name"

    Is this possible??

     

    Thanks!!

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 20, 2012 @ 19:19
    Dennis Aaen
    0

    Hi newibe and welcome to the umbraco forum.

    Yes it is certainly possible to print a different link text than just the content node name.

    Something like this should, solve your question, if I am not completely wrong.

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '2']">
    <ul>
    <li>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="./sectionName" />
    </a>
    </li>
    </ul>
    </xsl:for-each>

    Hope this can helps you.

    /Dennis

  • newbie 13 posts 33 karma points
    Feb 22, 2012 @ 11:26
    newbie
    0

    Hi dennis. i cant get this to work. I am creating the xlst file correct? ive tried both the templates "list subpages by level" and "list subpages from a changeable source"  but it still isnt showing the property as a navigation.

    Thanks!

    Newbie

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 22, 2012 @ 13:46
    Dennis Aaen
    0

    Hi again,

    I just saw I might have made a mistake. But I have not had the opportunity to test the code. And this is what is at  top of my mind right now what could be wrong.

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '2']">
     
    <ul>
     
    <li>
     
    <a href="{umbraco.library:NiceUrl(@id)}">
     
    <xsl:value-of select="sectionName"/>
     
    </a>
     
    </li>
     
    </ul>
    </xsl:for-each>

     

    I hope this will solve your problem.

    /Dennis

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 22, 2012 @ 17:48
    Dennis Aaen
    0

    Hi Newbie,

    Now I have the chance to test the code, and now I got it work as it should.

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

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="sectionName"/>
        </a>
      </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    The variable with the name level render in the example level 2 pages in the Umbraco content tree, If you want to render another level, you just have to set the value to for example 1 then the XSLT will render nodes from level 1 and so on.

    I hope this will solve your question

    /Dennis

  • newbie 13 posts 33 karma points
    Feb 22, 2012 @ 17:59
    newbie
    0

    Hi Dennis,

    This is AMAZING!!

    I think i totally understand what is happening here.

    Thanks for the help!!

    Starting to understand umbraco finally! :) 

    Newbie

     

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Feb 22, 2012 @ 18:49
    Dennis Aaen
    0

    Hi,

    Good and hear that you got it to work finally.

    Are you quite on what string (umbracoNaviHide)! = '1 ' does?

    If not, I can just quickly explain what it means.

    You have the option to hide menu items from your navigation. You can do this by create a property on your document type. The data type of the field must be a true / false, and this should  have an alias of umbracoNaviHide. So when the user tick in the check box the menu item will be hiding from the navigation.

    Hope this was useful information.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft