1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Phrase names and variables

Discussion in 'XenForo Development Discussions' started by katsulynx, Jan 14, 2015.

  1. katsulynx

    katsulynx Well-Known Member

    <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}}
    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.
  2. Valhalla

    Valhalla Well-Known Member

    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.
  3. katsulynx

    katsulynx Well-Known Member

    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.

Share This Page