Jump to content

Call PHP Inside smarty template


allex01

Recommended Posts

the whole point of smarty is to seperate PHP and HTML

 

first, you need to assign $page and $basename

 

so do something like:

 

$smarty -> assign ('page', basename($_SERVER['SCRIPT_NAME']) );

 

Don't put that in ur template, put it right before you $smarty -> display the template, okay?

 

Then in the template, put:

 

{if $page == 'index.php'} class="active" {/if}

 

Hope that helps!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.