Copied to clipboard

Flag this post as spam?

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


  • Inmedia 124 posts 176 karma points
    Jan 21, 2009 @ 12:13
    Inmedia
    0

    How do I include Frontpage i navigation?

    Hi Umbracians

    I'm pretty much a noob at Umbraco (but not for long o:) ). My problem is that I don't know how to include the frontpage in the navigation, I'm pretty sure the solution is quit simple, but I just don't know my XSLT that well yet.

    The XSLT-code for my navigation looks like this:







    Can anyone og you PROs help me please, that would really save my day... Well, perhaps not, but it would make me very happy o:)

  • Lesley 284 posts 143 karma points
    Jan 21, 2009 @ 12:33
    Lesley
    0

    Hi there and welcome to Umbraco!

    Not sure if this is necessarily best practice but I normally hard-code the link to home. So you would put:
    [code]


    [/code]

    It gets a bit more complicated if you want a different style for the "current" section to be highlighted, so come back to us if you need that.

    Lesley

  • Inmedia 124 posts 176 karma points
    Jan 21, 2009 @ 12:45
    Inmedia
    0

    [quote=Lezzles]Hi there and welcome to Umbraco!

    It gets a bit more complicated if you want a different style for the "current" section to be highlighted, so come back to us if you need that.

    Lesley[/quote]


    Hi Lesley

    Thats exactly what I want, the current style should apply on the Frontpage-link too.
    I did hard code it at first, but then I had trouble applying the current-style to it.
    Thats why I thought the best way to do this might be to include the frontpage i a non-hardcoded way somehow?

    // Mikkel

  • Marcus Grönström 2 posts 2 karma points
    Jan 12, 2010 @ 15:53
    Marcus Grönström
    0

    I need that, how would you do that?

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jan 12, 2010 @ 16:55
    Jesper Hauge
    0

    You could do:

    <li>
        <a href="/home.aspx">
            <xsl:if test="$currentPage/@nodeName = 'Home'">
                <xsl:attribute name="class">selected</xsl:attribute>
            </xsl:if>
            Home
        </a>
    </li>
    .. xsl code for building the nav links

    This basically checks to see if the currentpage is a page with node name 'Home', you should off course insert your actual node name here, and the it appends a class attribute to the a link like so: <a class="selected" href="/home.aspx">

    Regards
    Jesper Hauge

Please Sign in or register to post replies

Write your reply to:

Draft