Q
Q
Qurel2019-03-13 17:07:37
Smarty
Qurel, 2019-03-13 17:07:37

Smarty: how to correctly write a condition in an array?

It is necessary to display the element (index) of the array under a certain condition. What is the syntactically correct way to do this? Since I have written - the wrong syntax.

{include file="components/breadcrumbs.tpl" breadcrumbs=[
            ['link'=>"{$site_url}{$lang_url}/", 'title'=>"{"breadcrumps.Крошка1"|t}"],
            ['link'=>"{$site_url}{$lang_url}/company",'title'=>"{"breadcrumps.Крошка2"|t}"],

            {if $item.city}
                ['link'=>"{$site_url}{$lang_url}/company/{$item.city.alias}",'title'=> " в {$item.city.form2}"],
            {/if}

            ['title'=>{$smarty.capture.b_seo_title}]
        ]}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question