Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 886 posts 2415 karma points
    Aug 06, 2009 @ 16:27
    Claushingebjerg
    0

    menu from document type

    im trying to make a small secondary menu. im using the prdefined xslt for listing pages by document type:

    <xsl:variable name="documentTypeAlias" select="string('Kontaktmenu')"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/node [@nodeTypeAlias = $documentTypeAlias and string(data [@alias='umbracoNaviHide']) != '1']">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    Ive inserted this on my master template, but it only display on the frontpage of the site. It dissapears on all other pages. I guess i should be using some kind of $currentPage/ancestor-or-self::node but what is the correct syntax?

     

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 06, 2009 @ 16:30
    Thomas Höhler
    1
    <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=1]/descendant-or-self::node [@nodeTypeAlias = $documentTypeAlias and string(data [@alias='umbracoNaviHide']) != '1']>

    hth, Thomas

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Aug 06, 2009 @ 16:30
    Jan Skovgaard
    0

    Hej Claus

    Try writing this instead

    <xsl:for-each select="$currentPage/ancestor-or-self::node [@nodeTypeAlias =
    $documentTypeAlias and string(data [@alias='umbracoNaviHide']) !=
    '1']">
        <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
                <xsl:value-of select="@nodeName"/>
            </a>
        </li>
    </xsl:for-each>

    /Jan

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Aug 06, 2009 @ 16:31
    Jan Skovgaard
    0

    Argh, I'm just too slow! :)

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 06, 2009 @ 16:32
    Thomas Höhler
    0

    yeah, the first time I was faster...

    *g*

  • Claushingebjerg 886 posts 2415 karma points
    Aug 07, 2009 @ 11:48
    Claushingebjerg
    0

    Thanks for the effort, but it doesnt seem to work. Now the menu doesnt display on any page... not even the frontpage which worked before... Any idea why?

  • Claushingebjerg 886 posts 2415 karma points
    Aug 07, 2009 @ 14:36
    Claushingebjerg
    0

    Solved it. Example below

     

    <xsl:variable name="level" select="1"/>
    <xsl:variable name="documentTypeAlias" select="string('Kontaktmenu')"/>

    <xsl:template match="/">

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

    </xsl:template>

  • 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