How to check a complex condition in Smarty(PHP)
Posted
by php html
on Stack Overflow
See other posts from Stack Overflow
or by php html
Published on 2010-06-03T19:44:38Z
Indexed on
2010/06/03
20:04 UTC
Read the original article
Hit count: 219
I need to display a section or another in a smarty template. My condition is simple: if a smarty value starts with a string I should display one section, otherwise the other smarty section should be displayed. I can change only the tpl files.
{php}
if (substr($url,0,4) != 'http')
{
{/php}
section 1
{php}
}
else
{
{/php}
section 2
{php}
}
{/php}
The problem is that I can not read the url varible which was previously assigned using $smarty->assign. Basically, I'm looking for the smarty function that can be used to retrieve a value, or if there is a better solution.
© Stack Overflow or respective owner