Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Replace header.tpl changed to header2.tpl when changing lang

 
Post new topic   Reply to topic    Smarty Forum Index -> Language: Russian
View previous topic :: View next topic  
Author Message
Anna2727
Smarty n00b


Joined: 09 Jan 2019
Posts: 2

PostPosted: Wed Jan 09, 2019 7:59 am    Post subject: Replace header.tpl changed to header2.tpl when changing lang Reply with quote

Здравствуйте,
Может кто знает, как реализовать чтобы header.tpl менялся на header2.tpl при смене языка на сайте, пример, при переключений на английский https://www.domain.com/en/ подключался header2.tpl, кто знает дайте код, скажу спасибо= vmr.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1503

PostPosted: Thu Jan 10, 2019 1:43 pm    Post subject: Reply with quote

Для этого надо передать язык в настройки Smarty.
Например, через compile_id.
И я настоятельно советую сменить именование файлов на вменяемое.
Например, header-ru.tpl и header-en.tpl
Тогда код вырождается в
Code:
{include "header-{$smarty.template_object->getCompileId()}.tpl"}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Language: Russian All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP