In a page template there are 20 content blocks using a naming convention speaker_name_1, speaker_name_2, speaker_name_3 all assigned to same named variables. In a section loop I need to be able to recreate the name and get the value. i.e. equivalent in PHP
Code: Select all
for ($i=1;$i<=20;$i++) {
$block = 'speaker_name_' . $i;
$block;
}
Code: Select all
{section name=i start=1 loop=21}
{assign var="var_name" value="speaker_name_"|cat:"`$smarty.section.i.index`"}
{assign var="var_value" value=$var_name}
{$var_value}
{/section}