Phrase names and variables

Lukas W.

Well-known member
Code:
<xen:foreach loop="$text.link_tags" value="$tag" i="$i">
   <xen:if is="{$tag} == 1">
         <div class="tag tag_{$tag}">
             {xen:phrase Phrase_Tag{$tag}}
         </div>
   </xen:if>
</xen:foreach>

Is there a way to get the code snippet above working and call a different phrase each time it cycles through the loop or would I have to go the long way using a dumb if-elseif repeat queue? Shortly spoken this should call "Phrase_1", "Phrase_2", etc.
 
Regardless, you can't use a variable as part of the phrase name, but if you know what {$tag} equals, you would not have to.
 
Ye, that was actually my mistake there, I wanted to use $i instead of $tag in the variable name. Seems like i have to go the ugly way then.
 
Top Bottom