Easier way to use parent as class for sections
Posted: Sun Mar 07, 2010 2:48 am
I have a need in some sites to set the style for certain pages and their children, like sections, everything under this parent including the parent should look like this etc...
I have always used a UDT which means I had to remember it or I had to bookmark a thread/post here that has them, well NO more...
class='a{$friendly_position|truncate:1:"" == ""}' will give you the top menu items number from it's position in the menu and all of it's children get the same number, instead of a2.1 or a2.1.1 it will be class='a2'...
NOTE: The a is needed because you can't use numbers for class or ID, speaking of which this could be...
id='a{$friendly_position|truncate:1:"" == ""}'
Just make sure if it's an ID it's only used once in a template...
I have always used a UDT which means I had to remember it or I had to bookmark a thread/post here that has them, well NO more...
class='a{$friendly_position|truncate:1:"" == ""}' will give you the top menu items number from it's position in the menu and all of it's children get the same number, instead of a2.1 or a2.1.1 it will be class='a2'...
NOTE: The a is needed because you can't use numbers for class or ID, speaking of which this could be...
id='a{$friendly_position|truncate:1:"" == ""}'
Just make sure if it's an ID it's only used once in a template...