R
R
Ranger Nicholas2018-10-17 05:40:23
Smarty
Ranger Nicholas, 2018-10-17 05:40:23

How to increase condition priority in .tpl?

Hello. Please help me figure it out.
There is an online store with a huge number of pages and meta tags filled on them (description, title)
There was a need to change meta tags only on a couple of certain pages. I'm trying to make a condition through the code:

{if $page->url=='/catalog/elektricheskie-teplye-poly/brand-devi'}
{$meta_description = "Мы предлагаем купить теплый пол devi, цена на который у нас одна из самых низких, чтобы купить теплый пол деви, звоните по телефону: ☎ 8(3822) 44-33-55"}
{/if}
  
{if (!empty($meta_description) || !empty($meta_keywords) || !empty($filter_meta->description) || !empty($filter_meta->keywords)) && !$smarty.get.page}

    <meta name="description" content="{$meta_description|escape}{$filter_meta->description|escape}">
    <meta name="keywords" content="{$meta_keywords|escape}{$filter_meta->keywords|escape}">
{/if}

But this condition only works on pages where there are no meta tags at all. On pages where there are meta tags, the former ones are displayed, which are apparently written somewhere else.
How is it possible to increase the priority so that the meta tags that I write in the code on the condition are displayed, and not those that are in the administrative panel?
Please do not write such options as to replace these meta tags in the admin panel. I would like to understand this method.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ranger Nicholas, 2018-10-19
@rangernicholas

Understood. I answer myself.

//Проверяем url страницы,если страница, которая нам нужна то выводятся наши заданные мета-теги
 
{if $smarty.server.REQUEST_URI == "/catalog/bimetallicheskie-radiatory-otopleniya/brand-rifarbase"}
   {$meta_title = "Радиаторы отопления рифар - цена в интернет-магазине «Реоком»"}
   {$meta_description = "Мы предлагаем купить радиаторы отопления рифар,звоните по телефону"}
{/if}
 
 
//Затем если у страницы пустые мета-теги выводим уже присвоенные
 
{if (!empty($meta_description) || !empty($meta_keywords) || !empty($filter_meta->description) || !empty($filter_meta->keywords)) && !$smarty.get.page}
    <meta name="description" content="{$meta_description|escape}">
    <meta name="keywords" content="{$meta_keywords|escape}{$filter_meta->keywords|escape}">
{/if}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question