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:
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]
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:
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:
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?
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:
<> class="current">About Us
Anyone know how to do this?
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]
(Not tested though...)
Regards,
/Dirk
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]
- Home
[/code]Hope this makes sense!
Garry.
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]
- Home
[/code]Regards,
/Dirk
Ah so it was! Thanks Dirk its worked perfectly.
Garry.
Hi I am also trying to apply class="current" to the
This is my code
[code]
[/code]How did you do it?
Try
[code]
[/code]
HTH,
PeterD
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?
[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!
Correct, blame that on Dirk ;)
To mae it work:
[code]
[/code]
HTH,
PeterD
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]
Try this:
[code]
You are amzing man, thanks! It works great!
is working on a reply...