I use Smarty to implement my template. How can I write this PHP sentence.
<?php if(empty($_GET['action'])) { echo class="current"; } ?>
I use Smarty to implement my template. How can I write this PHP sentence.
<?php if(empty($_GET['action'])) { echo class="current"; } ?>
收起
当前问题酬金
¥ 0 (可追加 ¥500)
支付方式
扫码支付
Template engines were invented to separate business logic (and the request itself) from presentational logic. Template engine should not take care of $_GET, $_POST, $_SESSION, etc.
If you need to make a decision based on $_GET['action'] - then just pass it from your controller with reguler smarty's assign
.
Anyway, if you don't want your code to be more logical and obvious you could use $smarty.get.action
{if empty($smarty.get.action)}class="current"{/if}
报告相同问题?