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

Using PHP within a .tpl

 
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
N1CK3RS0N
Smarty Regular


Joined: 04 Mar 2009
Posts: 41

PostPosted: Fri Jan 03, 2014 8:30 pm    Post subject: Using PHP within a .tpl Reply with quote

I'm working on a tutorial PHP library and I need to execute some PHP coding but cannot get it to work.

I tried using this:
http://www.smarty.net/docsv2/en/language.function.php.tpl

But I get this error:
Quote:
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "templates\default\variables.tpl" on line 22 "{php}" unknown tag "php"' in C:\xampp\htdocs\wikiPHP\includes\smartyphp\libs\sysplugins\smarty_internal_templatecompilerbase.php:665 Stack trace: #0 C:\xampp\htdocs\wikiPHP\includes\smartyphp\libs\sysplugins\smarty_internal_templatecompilerbase.php(451): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "ph...', 22) #1 C:\xampp\htdocs\wikiPHP\includes\smartyphp\libs\sysplugins\smarty_internal_templateparser.php(2393): Smarty_Internal_TemplateCompilerBase->compileTag('php', Array) #2 C:\xampp\htdocs\wikiPHP\includes\smartyphp\libs\sysplugins\smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r37() #3 C:\xampp\htdocs\wikiPHP\includes\smartyphp\libs\sysplugins\smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(37) #4 C:\xampp\htdocs\wikiPHP\includes\smartyphp\libs\sysplugi in C:\xampp\htdocs\wikiPHP\includes\smartyphp\libs\sysplugins\smarty_internal_templatecompilerbase.php on line 665
Back to top
View user's profile Send private message
N1CK3RS0N
Smarty Regular


Joined: 04 Mar 2009
Posts: 41

PostPosted: Fri Jan 03, 2014 8:36 pm    Post subject: Reply with quote

I read it is now depreciated in Smarty 3. Is there an alternative solution?
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Fri Jan 03, 2014 10:20 pm    Post subject: Reply with quote

Use the SmartyBC library wrapper instead of Smarty.

http://www.smarty.net/docs/en/bc.tpl
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 -> 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