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

Smarty 3 RC3 released
Goto page 1, 2, 3  Next
 
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
mohrt
Administrator


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

PostPosted: Wed Jul 14, 2010 11:19 pm    Post subject: Smarty 3 RC3 released Reply with quote

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
View user's profile Send private message Visit poster's website
VEG
Smarty Rookie


Joined: 02 May 2010
Posts: 20
Location: Belarus

PostPosted: Thu Jul 15, 2010 12:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Jul 15, 2010 2:13 pm    Post subject: Reply with quote

This has been fixed in the SVN now.
Back to top
View user's profile Send private message
VEG
Smarty Rookie


Joined: 02 May 2010
Posts: 20
Location: Belarus

PostPosted: Thu Jul 15, 2010 2:47 pm    Post subject: Reply with quote

Oh, big thanks!
Back to top
View user's profile Send private message
Jerc
Smarty Rookie


Joined: 26 Jan 2010
Posts: 30
Location: Slovenia / Ljubljana

PostPosted: Tue Jul 20, 2010 11:45 am    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Jul 20, 2010 3:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
Jerc
Smarty Rookie


Joined: 26 Jan 2010
Posts: 30
Location: Slovenia / Ljubljana

PostPosted: Wed Jul 21, 2010 5:53 am    Post subject: Reply with quote

Thanks for the solution.
I have removed all {php} tags.
Back to top
View user's profile Send private message
mpopp
Smarty Rookie


Joined: 22 Jul 2010
Posts: 6

PostPosted: Thu Jul 22, 2010 8:06 pm    Post subject: Reply with quote

Hi,

could you please tag Smarty 3.0 RC3 in Subversion?

Thanks!
Back to top
View user's profile Send private message
DavidPFarrell
Smarty n00b


Joined: 22 Jul 2010
Posts: 2

PostPosted: Thu Jul 22, 2010 11:57 pm    Post subject: Problem Rendering Debug Console When Delimeters Are Changed. Reply with quote

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
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Fri Jul 23, 2010 12:49 am    Post subject: Reply with quote

mpopp wrote:
Hi,

could you please tag Smarty 3.0 RC3 in Subversion?

Thanks!


added
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Jul 23, 2010 1:02 pm    Post subject: Reply with quote

The change to use always { and } as delimiter for debug.tpl is in the SVN now
Back to top
View user's profile Send private message
mpopp
Smarty Rookie


Joined: 22 Jul 2010
Posts: 6

PostPosted: Fri Jul 23, 2010 5:22 pm    Post subject: Reply with quote

mohrt wrote:
mpopp wrote:
Hi,

could you please tag Smarty 3.0 RC3 in Subversion?

Thanks!


added


Thank you!
Back to top
View user's profile Send private message
Jerc
Smarty Rookie


Joined: 26 Jan 2010
Posts: 30
Location: Slovenia / Ljubljana

PostPosted: Tue Jul 27, 2010 11:04 am    Post subject: Reply with quote

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
View user's profile Send private message
Nitek
Smarty Rookie


Joined: 14 Feb 2009
Posts: 23

PostPosted: Tue Jul 27, 2010 11:43 am    Post subject: Reply with quote

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
View user's profile Send private message
Jerc
Smarty Rookie


Joined: 26 Jan 2010
Posts: 30
Location: Slovenia / Ljubljana

PostPosted: Tue Jul 27, 2010 1:50 pm    Post subject: Reply with quote

Thanks.
I see that i should read the manual first Smile
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 -> Smarty 3 All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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