Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
What I needed to change in order to update to Smarty 3

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
alex
Smarty Rookie


Joined: 03 Sep 2005
Posts: 19
Location: Argentina

PostPosted: Tue Mar 08, 2011 3:24 pm    Post subject: What I needed to change in order to update to Smarty 3 Reply with quote

Hi,
this is what I needed to change in order to update from Smarty 2 to Smarty 3. Maybe it's useful for someone.

Added this line to prevent warnings (Smarty 2 behavior):
Code:
$smarty->error_reporting = 'E_ALL & ~E_NOTICE';


Replaced:
Code:
$smarty->config_load('config.ini');
$lang = $smarty->get_config_vars();

by
Code:
$smarty->configLoad('config.ini', 'default');
$lang = $smarty->getConfigVars();


In Smarty 2 $smarty->config_load('config.ini'); loaded only the part of the config file wich wasn't in a section, Smarty 3 (configLoad) loads the complete file. Therefore I segmented the complete config file and always load explicitly the required section.

I used the compiler.defun-plugin[1] for recursion (see topic Recursion with Smarty[2]). This plugin does not work anymore with Smarty 3. Recursion can now be done with {function}[3] (however, it's a little bit slower than the compiler.defun-plugin).

[1] http://lammfellpuschen.de/compiler.defun/
[2] http://www.smarty.net/forums/viewtopic.php?t=291
[3] http://www.smarty.net/docs/en/language.function.function.tpl
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


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

PostPosted: Tue Mar 08, 2011 4:03 pm    Post subject: Reply with quote

Quote:
In Smarty 2 $smarty->config_load('config.ini'); loaded only the part of the config file wich wasn't in a section, Smarty 3 (configLoad) loads the complete file. Therefore I segmented the complete config file and always load explicitly the required section.


That's a bug, we're on it. [edit: fixed in SVN trunk]
Back to top
View user's profile Send private message Visit poster's website
alex
Smarty Rookie


Joined: 03 Sep 2005
Posts: 19
Location: Argentina

PostPosted: Tue Mar 08, 2011 6:20 pm    Post subject: Reply with quote

mohrt wrote:
That's a bug, we're on it. [edit: fixed in SVN trunk]


Thanks! configLoad works now as expected!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    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