Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Can't use php in templates

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Andrew_M
Smarty n00b


Joined: 04 Mar 2015
Posts: 2

PostPosted: Fri Sep 11, 2015 2:41 pm    Post subject: Can't use php in templates Reply with quote

I'm trying to create a tpl called billet.tpl for payment methods in cs-cart and I'd need to use PHP on it to get some informations about the order and to generate the URL to the billet but every time I put {php} {/php} on it I get an error (500 Internal Server Error) when I try to change to this new payment method as customer. This is the code:

Code:
    {php}
   global $base_domain;
   
    $orderInfo = $this->get_template_vars('order_info');
      .
      .
      .
    {/php}

    <br>
    <input type="radio" name="billet_radio" checked/>Billet Payment





This is the console error:

Quote:
http://dev.apmeds.com/checkout.html?active_tab=tab4&payment_id=12&full_render=true&result_ids=checkout*%2Cstep_four&is_ajax=1
500 (Internal Server Error)



Ps: I already changed the allow_php_templates to true in file Smarty.class.php. What I'm doing wrong? Is there another variable that I should set to true or something? Thanks.[img][/img]
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sat Sep 12, 2015 12:09 am    Post subject: Reply with quote

You should not use PHP in template code.
Is that so hard to understand?
Write a template function, if you absolutely must do it from Smarty side.
But in reality, you must have this information on hand before the page is sent to Smarty.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP