Answer the question
In order to leave comments, you need to log in
How to properly write condition in Smarty template?
It is necessary to display / not display content depending on the url address.
Example:
{if $smarty.server.REQUEST_URI == "/page"}
Everything would be fine, but this condition needs to work for:
/page-123
/page-newpage
/page-bla-bla-bla
How to implement?
UPD:
{if strpos($smarty.server.REQUEST_URI, "text_that_should_be_in_url")}
Answer the question
In order to leave comments, you need to log in
these checks should go to php, smart is a template engine, it is for html output. This is simply not true. But on the off-forum, smarty says that almost all PHP functions work. For example, checking for a number would look like this:
{if is_numeric($getnumeric)}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question