 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
alex Smarty Rookie
Joined: 03 Sep 2005 Posts: 19 Location: Argentina
|
Posted: Tue Mar 08, 2011 3:24 pm Post subject: What I needed to change in order to update to Smarty 3 |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7062 Location: Lincoln Nebraska, USA
|
Posted: Tue Mar 08, 2011 4:03 pm Post subject: |
|
|
| 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 |
|
alex Smarty Rookie
Joined: 03 Sep 2005 Posts: 19 Location: Argentina
|
Posted: Tue Mar 08, 2011 6:20 pm Post subject: |
|
|
| mohrt wrote: | | That's a bug, we're on it. [edit: fixed in SVN trunk] |
Thanks! configLoad works now as expected! |
|
| 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
|