Copied to clipboard

Flag this post as spam?

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


  • gustav 11 posts 53 karma points
    Oct 29, 2013 @ 20:16
    gustav
    0

    create tree menu starting from level 3

    Hi Im new to Umbraco, but i have been trying to make a tree menu using default XSLT without success.

    Im having two different top menus and i want my left tree submeny starting from level 3 frum the tree structure in Umbraco.

    I have tested XSLT "list subfolder from current position" but the parent of the tree strucure will be lost. I have also tested to list the whole site using the default site script. When im using this I can´´t figure out how i can use it to list the tree structure starting from level 3 on different trees. (depending in wich item from menu 2 that is selected) I have tested to list subfolder from current position starting from level3, but then the parents are also lost.

    Menu1 Menu 1 Menu1 Menu 1

    Menu2 Menu2 Menu 2 Menu 2

    Menu3

       Submenu3

    Menu3

       Submenu3

    Menu3

       Submenu3

     

    is there any one that has the solution to my proble?

    BR Gustav

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 29, 2013 @ 20:35
    Dennis Aaen
    0

    Hi Gustav,

    I have you tried the Navigation prototype and set it to start at level 3. An see if this can solve your problem.

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

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
                    <!-- we're under the item - you can do your own styling here -->
                    <xsl:attribute name="class">selected</xsl:attribute>
                </xsl:if>
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:for-each>
    </ul>

    Hope this helps,

    /Dennis

  • gustav 11 posts 53 karma points
    Oct 30, 2013 @ 08:02
    gustav
    0

    HI Dennis and thanks for your help!

    The navigation prototype will only list items from level 3 and not it´s children. Any suggestion what im doing wrong? 

    /gustav 

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Oct 30, 2013 @ 08:27
    Dennis Aaen
    0

    Hi Gustav.

    Try to see if this post can pull you in the right direction.

    http://our.umbraco.org/forum/developers/xslt/27134-display-the-parent-and-child-nodes-in-a-navigation

    Hope this helps you,

    /Dennis

  • gustav 11 posts 53 karma points
    Nov 17, 2013 @ 17:48
    gustav
    0

    I can´t get this navigation to work. No one that has managed to get this type of navigation to  workand that has an exmaple? Menus below leevel 3 will not be displayed.

     

    When i open a menu, i want the parent of menu3 to be displayed same time as its children are.

     

    Anyone out there who has the solution to this problem?

    <?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:Examine="urn:Examine"
        exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets Examine ">


    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
    <!-- Use div elements around this macro combined with css -->
    <!-- for styling the navigation -->
    <xsl:variable name="level" select="3"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
                    <!-- we're under the item - you can do your own styling here -->
                    <xsl:attribute name="class">selected</xsl:attribute>
                </xsl:if>
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    </xsl:stylesheet>

    BR

    Gustav

Please Sign in or register to post replies

Write your reply to:

Draft