Copied to clipboard

Flag this post as spam?

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


  • Garry Bain 149 posts 124 karma points
    Mar 19, 2009 @ 14:32
    Garry Bain
    0

    Current page class

    Hi guys,

    I posted something similar on a different topic when I asked about adding a "current" class into a "hard coded" menu. However, I am using the "List pages by level" XSLT file and want to be able to add a class called "current" to the current page I am at, for example:

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 19, 2009 @ 14:39
    Dirk De Grave
    0

    Hi,

    Might become a bit difficult if you're using a hard coded menu? As from reading your code, a check against $currentPage/@nodeName could do the trick...
    [code]


  • [/code]

    (Not tested though...)

    Regards,
    /Dirk

Copy Link
  • Garry Bain 149 posts 124 karma points
    Mar 19, 2009 @ 14:44
    Garry Bain
    0

    Hi Dirk, I'm sorry I should have made myself clear, this time I am not using a "hard coded" menu, instead I am using the foreach loop you get from the "List pages by level" XSLT:

    [code]

    [/code]

    Hope this makes sense!
    Garry.

    Copy Link
  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 19, 2009 @ 14:58
    Dirk De Grave
    0

    Garry,

    Answer is still in last post. But instead of testing against 'Home', check against the current's node @nodeName or, even better, compare the two @id's, so check would become:

    [code]

    [/code]

    Regards,
    /Dirk

    Copy Link
  • Garry Bain 149 posts 124 karma points
    Mar 19, 2009 @ 15:04
    Garry Bain
    0

    Ah so it was! Thanks Dirk its worked perfectly.

    Garry.

    Copy Link
  • Lotus 22 posts 20 karma points
    Mar 26, 2009 @ 21:17
    Lotus
    0

    Hi I am also trying to apply class="current" to the

  • but I it doesnt parse.

    This is my code

    [code][/code]

    How did you do it?

  • Copy Link
  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 26, 2009 @ 21:36
    Peter Dijksterhuis
    0

    Try

    [code]

    [/code]

    HTH,
    PeterD

    Copy Link
  • Lotus 22 posts 20 karma points
    Mar 26, 2009 @ 23:24
    Lotus
    0

    Hello PeterD,
    Many thanx for your suggestion. I tried it and variants of it but as I am new to XSLT I dont really know what I am doing. #-o I have spent many hours reading about XSLT and found some good tutorials but not enaugh.

    Got an error "Error reading XSLT file: \xslt\Pama-Sub-Menu.xslt " that goes away when removing the if-statement.


    Do you know any good sources I can read about how the if-statement works?

    Copy Link
  • Garry Bain 149 posts 124 karma points
    Mar 26, 2009 @ 23:39
    Garry Bain
    0

    [quote=Lotus]Got an error "Error reading XSLT file: \xslt\Pama-Sub-Menu.xslt " that goes away when removing the if-statement.[/quote]

    Hi,

    I think your

    [code][/code]

    Then again I'm new to XSLT so it might be something else! Hopefully that works!

    Copy Link
  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 26, 2009 @ 23:50
    Peter Dijksterhuis
    0

    Correct, blame that on Dirk ;)

    To mae it work:

    [code]




    [/code]

    HTH,
    PeterD

    Copy Link
  • Lotus 22 posts 20 karma points
    Mar 27, 2009 @ 08:27
    Lotus
    0

    Yes!! Above code works!! Many many thanks =d>

    So far so good, now i need the menu to stay current as one views its children.

    No good code
    [code]

    Copy Link
  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 27, 2009 @ 08:40
    Peter Dijksterhuis
    0

    Try this:
    [code]

    Copy Link
  • Lotus 22 posts 20 karma points
    Mar 27, 2009 @ 08:48
    Lotus
    0

    You are amzing man, thanks! It works great!

    Copy Link
  • Please Sign in or register to post replies

    Write your reply to:

    Draft