|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
edduvs Smarty Rookie
Joined: 27 Jun 2011 Posts: 10
|
Posted: Mon Jun 27, 2011 11:33 pm Post subject: How can I enable {php} tags in Smarty 3.1 ? |
|
|
As the title says, i downloaded smarty 3.1, everything works fine, but i can't enable php tags, i read the changelog and somewhere in there says sth about smartyBC, as it has the php allow condition, but how in the gods name can i enable it again ? Updated from 3.0.8 |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
|
Back to top |
|
edduvs Smarty Rookie
Joined: 27 Jun 2011 Posts: 10
|
Posted: Tue Jun 28, 2011 11:27 am Post subject: |
|
|
i changed to include('inc/libs/SmartyBC.class.php');
Code: | Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template ".\inc/files\game.tpl" on line 82 "{php} require('actions/'.$_GET["screen"].'.php'); {/php}" unknown tag "php"' in |
It still seems that I have to enable the tags from somewhere. I know that in 3.0.8 i had allow_php_tags = true, but here ? what do i need to change in smarty backwards compiler ?
And yes, i deleted the cache and compiled directory contents.. |
|
Back to top |
|
edduvs Smarty Rookie
Joined: 27 Jun 2011 Posts: 10
|
Posted: Tue Jun 28, 2011 1:00 pm Post subject: |
|
|
Oh I got it, you need to set $smarty = new SmartyBC; instead of new Smarty ! Thanks anyway. |
|
Back to top |
|
hkirsman Smarty Rookie
Joined: 13 Apr 2011 Posts: 10
|
Posted: Wed Jun 29, 2011 3:51 pm Post subject: |
|
|
Or you could modify the old php plugin and add it to externals\smarty\libs\plugins\block.php.php like it use to be.
Code: |
<?php
/**
* Smarty plugin to execute PHP code
*
* @package Smarty
* @subpackage PluginsBlock
* @author Uwe Tews
*/
/**
* Smarty {php}{/php} block plugin
*
* @param string $content contents of the block
* @param object $template template object
* @param boolean $ &$repeat repeat flag
* @return string content re-formatted
*/
function smarty_block_php($params, $content, $template, &$repeat)
{
/*if (!$template->allow_php_tag) {
throw new SmartyException("{php} is deprecated, set allow_php_tag = true to enable");
} */
eval($content);
return '';
}
?>
|
|
|
Back to top |
|
edduvs Smarty Rookie
Joined: 27 Jun 2011 Posts: 10
|
Posted: Wed Jun 29, 2011 4:07 pm Post subject: |
|
|
I think it's quite easier to switch from replace Smarty (case sensitive) in any file with SmartyBC that will change the include and the class initialisation. |
|
Back to top |
|
|
|
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
|