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

{php}{/php} error in template

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
destinationOne
Smarty n00b


Joined: 21 Dec 2012
Posts: 1

PostPosted: Fri Dec 21, 2012 6:23 am    Post subject: {php}{/php} error in template Reply with quote

Hi everybody,

I am using the SmartyEngine for the first time - at the moment, everything works fine, except one thing.

I have template file "header.tpl" an in this file I want to add a little bit of PHP-Code. I have done this like so:
Code:
{php}echo "Hello World";{/php}


When I open the page, this error appears:
http://pastehtml.com/view/cmbelf3vs.txt

I tried to delete the content of the php tags like so:
Code:
{php} {/php}


But the error shows up again.


Whats wrong here?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Dec 21, 2012 2:15 pm    Post subject: Reply with quote

If you are using Smarty 3, the {php} tag was removed. You can use backward-compatible mode if you really want it. But, there is *always* a better way than embedding PHP code in templates.

http://www.smarty.net/best_practices
Back to top
View user's profile Send private message Visit poster's website
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 -> Smarty 3 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