What I need to be able to do is embed variables within variables within Smarty. Here's the use case:
Assume the following variables have been defined as assigned elsewhere in the template:
Code: Select all
{assign var=track1 value="One"}
{assign var=track2 value="Value value"}
{assign var=track3 value="Some test value"}
I'd like to be able to write a loop that runs through these variables and prints out these values (instead of printing them out one by one manually). So something like (pseudocode)
Code: Select all
{section name=foo start=1 loop=17 step=1}
{assign var=myvar value="track"$smarty.section.foo.index}
{eval $myvar}
{/section}
One
Value value
Some test value
...
but all I get is
track1
track2
track3
...
So question is can I embed variables within variables in smarty and use eval or something else to process it as desired.
Any helpful hints will be much appreciated.
TIA
Sanjay