This code displays the city:
{%$allregions[$message.region].name%} How to insert into this variable the text that would be: " in the city"
This code displays the city:
{%$allregions[$message.region].name%} How to insert into this variable the text that would be: " in the city"
Why add something to a variable if the templates are created just for the inverse problem?
<div> <b>в</b> {%$allregions[$message.region].name%} </div> update by comments
if -ov to regulate the output of the add. characters.that is, let's say your template, let's call it, title_inc.tpl looks like this
{%foreach from=$title_reverse item='tit' name='i'%} {%$tit.name|strip_tags%} {%if $smarty.foreach.i.last eq false %} {%$allregions[$message.region].name%} / {%/if%} {%/foreach%} then connect it as follows
{$r = "в ".$allregions[$message.region].name} {include "title_inc.tpl" rname=$r} and change the template itself
{%foreach from=$title_reverse item='tit' name='i'%} {%$tit.name|strip_tags%} {%if $smarty.foreach.i.last eq false %} {%$rname|default:%$allregions[$message.region].name%} / {%/if%} {%/foreach%} There can be many variations, for example
{include "title_inc.tpl" prefix="в "} ... {%if $smarty.foreach.i.last eq false %} {%prefix%}{%$allregions[$message.region].name%} / {%/if%} This option is probably more convenient and flexible in the future.
In general, it is not clear, of course, why do you need tags {% %} %% {% %} instead of the usual { } , IMHO complicates the readability of the code. In addition, Smarty 3, which looks more concise:
{foreach $title_reverse as $tit} {$tit.name|strip_tags} {if !$tit@last} {$prefix}{$allregions[$message.region].name} / {/if} {/foreach} Source: https://ru.stackoverflow.com/questions/770496/
All Articles