user353277
user353277

Reputation: 17

how to add php code in .tpl type of file in cs-cart

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 '<input type="hidden" name="check" value="redirect" />' ;

 } 
 else{

     echo '<input type="hidden" name="check" value="notredirect" />' ;
 }

{/php}

Upvotes: 0

Views: 2466

Answers (2)

vlad
vlad

Reputation: 1

You must set:

'allow_php_in_templates' => true, // Allow to use {php} tags in templates

in your config.local.php, and then it will work.

Upvotes: 0

Davis Z. Cabral
Davis Z. Cabral

Reputation: 514

I think that what you want is this:

<input type="hidden" name="check" value="{if $smarty.get.redirect != "clipboard"}not{/if}redirect" />

Upvotes: 1

Related Questions