View previous topic :: View next topic |
Author |
Message |
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Jul 14, 2010 11:19 pm Post subject: Smarty 3 RC3 released |
|
|
The third RC of Smarty 3 has been released! Please join the developer mailing list and see the Smarty 3 section of the forums and give us feedback!
NOTE: Documentation for Smarty 3 is still being finalized, please use the README for now.
http://www.smarty.net/ |
|
Back to top |
|
VEG Smarty Rookie
Joined: 02 May 2010 Posts: 20 Location: Belarus
|
Posted: Thu Jul 15, 2010 12:35 pm Post subject: |
|
|
In Smarty 2 $smarty.template contains relative path and filename. In Smarty 3 RC3 this variable contains only filename. Is it correct behaviour? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Jul 15, 2010 2:13 pm Post subject: |
|
|
This has been fixed in the SVN now. |
|
Back to top |
|
VEG Smarty Rookie
Joined: 02 May 2010 Posts: 20 Location: Belarus
|
Posted: Thu Jul 15, 2010 2:47 pm Post subject: |
|
|
Oh, big thanks! |
|
Back to top |
|
Jerc Smarty Rookie
Joined: 26 Jan 2010 Posts: 30 Location: Slovenia / Ljubljana
|
Posted: Tue Jul 20, 2010 11:45 am Post subject: |
|
|
Hi.
I've updated our site from Smarty 2 to Smarty 3.
I don't know if this is a bug:
Code: | {php}
if (in_array(basename($_SERVER['PHP_SELF']), array('all.php5'))) {
{/php}
<h2>Hello</h2>
{php}
}
{/php}
|
I got:
Parse error: syntax error, unexpected $end in /var/www/html/sites/smarty/plugins/block.php.php(24) : eval()'d code on line 1
Parse error: syntax error, unexpected '}' in /var/www/html/sites/smarty/plugins/block.php.php(24) : eval()'d code on line 1 |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Jul 20, 2010 3:21 pm Post subject: |
|
|
The use of {PHP} tags is decripated because of security risks and a lot of other problems. For that reasion n Smarty3 the {php} tags are disabled by default and when enabled the implementation is different from that in Smarty2 which does not allow to break the PHP if statement in serveral sections.
Anyway your piece of code will run in Smarty3 template syntax without the need of {php}
Code: | {if in_array(basename($_SERVER['PHP_SELF']), array('all.php5'))}
<h2>Hello</h2>
{/if} |
|
|
Back to top |
|
Jerc Smarty Rookie
Joined: 26 Jan 2010 Posts: 30 Location: Slovenia / Ljubljana
|
Posted: Wed Jul 21, 2010 5:53 am Post subject: |
|
|
Thanks for the solution.
I have removed all {php} tags. |
|
Back to top |
|
mpopp Smarty Rookie
Joined: 22 Jul 2010 Posts: 6
|
Posted: Thu Jul 22, 2010 8:06 pm Post subject: |
|
|
Hi,
could you please tag Smarty 3.0 RC3 in Subversion?
Thanks! |
|
Back to top |
|
DavidPFarrell Smarty n00b
Joined: 22 Jul 2010 Posts: 2
|
Posted: Thu Jul 22, 2010 11:57 pm Post subject: Problem Rendering Debug Console When Delimeters Are Changed. |
|
|
Greetings,
I use '{{' and '}}' as delimiters in my site, which is a familiar syntax as well as never interfering with Javascript or CSS content.
I just upgraded from Smarty2 to Smarty3 RC3 and found that the default debug template does not get compiled but just inserted into the bottom of the page uncompiled.
It may be that you expect users to create their own copy of debug.tpl if they change delimiters, but I didn't like this option, so I made some minor code changes:
=== Smarty.class.php ===
Code: |
public $debug_tpl = null;
+ public $debug_left_delimiter = "{";
+ public $debug_right_delimiter = "}";
|
=== smarty_internal_debug.php ===
Code: |
public static function display_debug($smarty)
{
// prepare information of assigned variables
$_assigned_vars = $smarty->tpl_vars;
ksort($_assigned_vars);
$_config_vars = $smarty->config_vars;
ksort($_config_vars);
+ $ldelim = $smarty->left_delimiter;
+ $rdelim = $smarty->right_delimiter;
+ $smarty->left_delimiter = $smarty->debug_left_delimiter;
+ $smarty->right_delimiter = $smarty->debug_right_delimiter;
$_template = new Smarty_Template ($smarty->debug_tpl, $smarty);
$_template->caching = false;
$_template->force_compile = false;
$_template->security = false;
$_template->cache_id = null;
$_template->compile_id = null;
$_template->assign('template_data', self::$template_data);
$_template->assign('assigned_vars', $_assigned_vars);
$_template->assign('config_vars', $_config_vars);
$_template->assign('execution_time', microtime(true) - $smarty->start_time);
echo $smarty->fetch($_template);
+ $smarty->left_delimiter = $ldelim;
+ $smarty->right_delimiter = $rdelim;
}
|
These changes should allow the default debug.tpl template to work even if you change delimiters.
NOTE: It is a good idea to delete your cached/compiled templates after applying the change. I suppose you can just delete the cached/compiled debug template, if you can find it, but for me it was easier to just delete them all. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jul 23, 2010 12:49 am Post subject: |
|
|
mpopp wrote: | Hi,
could you please tag Smarty 3.0 RC3 in Subversion?
Thanks! |
added |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Jul 23, 2010 1:02 pm Post subject: |
|
|
The change to use always { and } as delimiter for debug.tpl is in the SVN now |
|
Back to top |
|
mpopp Smarty Rookie
Joined: 22 Jul 2010 Posts: 6
|
Posted: Fri Jul 23, 2010 5:22 pm Post subject: |
|
|
mohrt wrote: | mpopp wrote: | Hi,
could you please tag Smarty 3.0 RC3 in Subversion?
Thanks! |
added |
Thank you! |
|
Back to top |
|
Jerc Smarty Rookie
Joined: 26 Jan 2010 Posts: 30 Location: Slovenia / Ljubljana
|
Posted: Tue Jul 27, 2010 11:04 am Post subject: |
|
|
Another question:
This line throws Exeption (works with 2.6.26):
Code: | {if 0 == $id || 2 == $id || 3 == $id }
Uncaught exception 'Exception' with message 'Syntax Error in template .... smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 403
|
If i remove space before } then no exception is returned. |
|
Back to top |
|
Nitek Smarty Rookie
Joined: 14 Feb 2009 Posts: 23
|
Posted: Tue Jul 27, 2010 11:43 am Post subject: |
|
|
Thats a new feature: " }" is not interpreted as a closing delimiter anymore. This allows you to have javascript-code in your templates without using literal-blocks oder {rdelim} {ldelim} constructs. |
|
Back to top |
|
Jerc Smarty Rookie
Joined: 26 Jan 2010 Posts: 30 Location: Slovenia / Ljubljana
|
Posted: Tue Jul 27, 2010 1:50 pm Post subject: |
|
|
Thanks.
I see that i should read the manual first |
|
Back to top |
|
|