S
S
Sergey Valitov2017-03-26 17:23:25
PHP
Sergey Valitov, 2017-03-26 17:23:25

How to insert php code into Smarty tpl?

Hello! Guys, tell me how to insert php code into smart. There I have a condition in which $_SERVER['request_uri'] is checked. I can't figure out how to edit..

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Reshetnyak, 2018-07-11
@Vampireos

better use

{if strpos($smarty.server.REQUEST_URI,"часть нужного адреса /home/ например ") !== false}
контент
{/if}

N
NoMeRus, 2017-07-07
@NoMeRus

{php}
....
{/php}

K
kolo2012, 2017-03-26
@kolo2012

like an array.
Reading the doc. Googled it in 15 seconds. www.smarty.net/docsv2/ru/language.variables.smarty.tpl

E
Eugene, 2017-06-05
@Flashter

{if ($_SERVER['request_uri']) == *** }
//ваш код
{else}
//ващ код
{/if}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question