Reputation: 1240
I use Smarty to implement my template. How can I write this PHP sentence.
<?php if(empty($_GET['action'])) { echo class="current"; } ?>
Upvotes: 0
Views: 1408
Reputation: 254916
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}
Upvotes: 1