Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

How to print Variable as part of string larger string


3 Posts   1101 Views


20 January 2010 at 2:38am Community Member, 45 Posts

I need to add a mouseover event to navigation links and want to have the $URLSegment as part of the unique name. However, it appears that I cannot do this b/c the variable is inserted in the middle of a larger string.

see example below:

<a href="$Link" onMouseOver='document.nav_$URLSegment.src=nav_$URLSegment_over.src;' onMouseOut='document.nav_$URLSegment.src=nav_$URLSegment_off.src;'><img src="/$ThemeDir/images/nav-$URLSegment-off.jpg" name="nav_$URLSegment" style="display:block;border:none;padding-left:5px;float:right;" /></a>

other than creating functions to handle creating the entire string, is there another method to be able to tell the template where to start or end the variable name?


20 January 2010 at 6:27pm Forum Moderator, 5511 Posts

You can 'escape' the variable by using { }. Eg SomeStringWith{$AVar}InTheMiddle


26 January 2010 at 11:43am Community Member, 45 Posts

thank you. exactly what i needed.