|
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 |
imp4ct Smarty n00b
Joined: 14 Nov 2009 Posts: 3
|
Posted: Sat Nov 14, 2009 2:31 pm Post subject: SmartyML for Smarty 3 |
|
|
Hi,
I'm really happy that Smarty 3 is almost finished but I have a question.
I'm now using SmartyML.class since I need to work with languages files. SmartyML.class is an extention on the normal Smarty 2 class.
But now with Smarty 3 I'm quite sure this extention won't work anymore. Therefor I was wondering if it would be possible to maybe implement this fucntion into Smarty 3, because it's actually very usefull.
Or, if it's not possible to add it to Smarty 3, I'm hoping that it still will be possible to extend the Smarty3.class and make some sort of Smarty3ML.class.
Thanks! |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Nov 14, 2009 3:02 pm Post subject: |
|
|
If you extend the SMarty3 class you must use PHP5 style __construct functions.
Replace
Code: | function smartyML ($locale="") {
$this->Smarty();
// Multilanguage Support
// use $smarty->language->setLocale() to change the language of your template
// $smarty->loadTranslationTable() to load custom translation tables
$this->language = new ngLanguage($locale); // create a new language object
$GLOBALS['_NG_LANGUAGE_'] =& $this->language;
$this->register_prefilter("smarty_prefilter_i18n");
}
|
with
Code: | function __construct ($locale="") {
parent::__construct();
// Multilanguage Support
// use $smarty->language->setLocale() to change the language of your template
// $smarty->loadTranslationTable() to load custom translation tables
$this->language = new ngLanguage($locale); // create a new language object
$GLOBALS['_NG_LANGUAGE_'] =& $this->language;
$this->register_prefilter("smarty_prefilter_i18n");
}
|
I have not tested it myself. So any feedback is wellcome. |
|
Back to top |
|
imp4ct Smarty n00b
Joined: 14 Nov 2009 Posts: 3
|
Posted: Sat Nov 14, 2009 6:44 pm Post subject: |
|
|
I'll try it as soon as possible!
Thanks! |
|
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
|