Smarty: How to Check if the Current Page is the Home/Front Page

Step 1 – check inside the php coding part if the current page is the home page:

if ($_SERVER['PHP_SELF'] == '/index.php'){
    $smarty->assign( 'isHome', true );
    $smarty->assign( 'isHome', false );

Step 2 – inside tpl themes files:

<{if $isHome}>
.... some code here .....

Leave a Reply

Your email address will not be published. Required fields are marked *