Smarty If URL Contains

可紊 提交于 2019-12-04 02:37:17

You can use strpos to check if a string has another string inside of it.

$pos = strpos($smarty.get.page, "product.php");

if($pos !== false) {
 // found, do something
}

Except you need to wrap it in {php} and {/php}.

$smarty.get.page translates to $_GET['page'], so you could replace it with the GET variable as well.

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

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!