Copied to clipboard

Flag this post as spam?

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


  • snorlaks 3 posts 23 karma points
    Feb 22, 2010 @ 13:26
    snorlaks
    0

    remeber class in menu

    Hi,

     

    Im using sample menu from tutorials. It is created dynamibally by xslt macro- normal ul li. I also use css which has different class for actual menu element. Named for example current-element.

     

    Problem is that I dont know how can I tell application which menu element is actual and chould have different css class so that it can be rendered in another way.

     

    Using simple Asp.Net I could store that information in viewstate or just send it with post and so on.

     

    thanks for help

  • dandrayne 1138 posts 2262 karma points
    Feb 22, 2010 @ 13:31
    dandrayne
    0

    Hi Snorlaks

    If I understand your question correctly, you can find the current page (or current parents)  with something like below

    <xsl:for-each select="$currentPage/node">
    <li>
    <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
    <xsl:attribute name="class">current</xsl:attribute>
    </xsl:if>
    </li>
    </xsl:for-each>

    If it's only the "actual" current page you want, it would be something like

    $currentPage/@id = current()/@id

    Hope this helps,
    Dan

  • snorlaks 3 posts 23 karma points
    Feb 22, 2010 @ 14:13
    snorlaks
    0

    This is excactly what I was looking for.

     

    Thank You very much for help.

     

    By the way where did You learn how to use xslt in umbraco ?

  • dandrayne 1138 posts 2262 karma points
    Feb 22, 2010 @ 14:19
    dandrayne
    0

    No problem, glad you got it sorted.

    For xslt in umbraco, I'd start with http://umbraco.org/documentation/books/xslt-basics and looking at the macros in http://our.umbraco.org/projects/business-website-starter-pack or http://our.umbraco.org/projects/creative-website-starter-(cws). ; You may learn to love it!

    Dan

  • 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