17488 Posts in 4473 Topics by 1978 members
|Go to End|
18 September 2007 at 9:12am Last edited: 18 September 2007 9:13am
Using the Menu control, how can I add a unique ID to every LI tag that gets printed? If I use the $Title or $MenuTitle variables, I end up with spaces in the name, and if I use $Link, I end up with slashes in the name, all of which are invalid. Any ideas? Is there a variable available that outputs the current iteration of the loop? Or maybe the URL text of the page without the slashes? How is this usually done?
18 September 2007 at 9:35am
You can use $URLSegment
Core Development Team
18 September 2007 at 7:16pm
Depending on what I'm doing, I'll use $URLSegment, $ID or $Pos... I can't remember if $Pos was something I hacked in or not, it's quite possible that it is (it returns the nth item in the list, e.g. 3 for the third item etc).
$ID returns the database ID of the current page/data object. Obviously, you can't use these on their own, I normally prefix them with a descriptor - e.g. <li id="Booking_$ID"> or similar.
19 September 2007 at 1:21am
Wow.. this is great. Thanks, guys. How do you know all those template variables? If I had a list of all of those, I could have figured it out, but I looked everywhere. Any leads?
|Go to Top|