Smarty If URL Contains

99823 picture 99823 · Nov 26, 2011 · Viewed 29.6k times · Source

Using Smarty Tags I'd like to determine if an URL contains a word, something like:

{if $smarty.get.page contains "product.php"} .....

I know contains doesn't exist, but how could I easily go about writing something similar to achieve the above code?

Answer

meze picture meze · Nov 26, 2011

All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc.

{if strpos($smarty.get.page, "product.php") !== false}