Forums / Setup & design / Scoping Help Please
Arran Price
Monday 14 February 2005 2:27:30 pm
Hi all, Im having some issues with variable scoping. The code below is used in a drop down menu where I want to pad the output with non breaking spaces. Note that I tried using pad but it only seemed to want one character and I couldnt use . If you know how to use pad in that manner I would love to see how, but I need to understand the scoping anyway.Im using 3.4.4 The padding_string variable is the one I need to get correctly, the frog/dog/cat etc are my testing (only frog works).
{section name=menuloop loop=$menu_items} {set itempadding = $padding|sub($item.object.data_map.short_name.content|count_chars) frog='FFFF' } {section name=paddingloop loop=$itempadding} {set menuloop:padding_string=concat($menuloop:padding_string,"B")} {set menuloop:cat='CCCCC'} {set dog='DDDDD'} {/section} <li> <a href={$menuloop:item.url_alias|ezurl}>{$menuloop:item.object.data_map.short_name.content}{$menuloop:padding_string}{$menuloop:frog}{$menuloop:cat}{$cat}{$menuloop:dog}{$dog}{$paddingloop:dog}{$menuloop:paddingloop:dog}{$menuloop:paddingloop.dog}</a> </li> {/section}
Any help greatly appreciated.
cheers
Arran
Sunday 20 February 2005 1:00:43 pm
Anyone? Ultimately I need to take a folder name, replace any spaces with and pad with more   up to a certain length.The line breaking is currently playing havoc with my drop down menu.