hi,
can anyone tell me how to add php code in .tpl file e.g i want to add the following code but it didn't work
{php}
if(isset($_GET['redirect']) && $_GET['redirect']=='clipboard'){
echo '' ;
}
else{
echo '' ;
}
{/php}
Why?
Why not use:
{if $smarty.request.redirect == 'clipboard'}
{assign var="redirect_val" value="redirect"}
{else}
{assign var="redirect_val" value="notredirect"}
{/if}
Suggest you read the smarty manual. You should avoid (at almost whatever cost) putting PHP code in the templates.
thanks for your help …but i did it already.
i use that way
{if $smarty.get.redirect eq 'string'}some thing {/if}
and its working fine
[quote name='doc1' timestamp='1312569368' post='118945']
thanks for your help …but i did it already.
i use that way
{if $smarty.get.redirect eq 'string'}some thing {/if}
and its working fine
[/quote]
You can do this
{php}
// including a php script directly from the template.
include('/path/to/custom.php');
{/php}