There is a code:

{%foreach from=$title_reverse item='tit' name='i'%} {%$tit.name|strip_tags%} {%$allregions[$message.region].name%} {%if $smarty.foreach.i.last eq false %} / {%/if%} {%/foreach%} {%if $regions|@count > 0%} {%$locale.1019%} {%foreach from=$regions item='region' name='i'%} {%$region.name%}{%if $smarty.foreach.i.last eq false %}, {%/if%} {%/foreach%} {%/if%} 

It displays the text like this: Name + City / Site name + City + Region

How to fix the code to display everything as well, except for the second time "City"?

  • already go to smarti 3, where the syntax is much more convenient - teran

1 answer 1

With this code:

  {%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%} {%if $regions|@count > 0%} {%$locale.1019%} {%foreach from=$regions item='region' name='i'%} {%$region.name%}{%if $smarty.foreach.i.last eq false %}, {%/if%} {%/foreach%} {%/if%} 

There will be a test output in this order: Name + City / Site Name + Region