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 7:16pm
Core Development Team,
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.