|
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 |
Backdraft007 Smarty n00b
Joined: 10 Oct 2013 Posts: 2
|
Posted: Fri Oct 11, 2013 12:56 pm Post subject: SmartyML und fetch() |
|
|
Hallo zusammen,
ich arbeite jetzt schon etwas länger mit Smarty. Nun stoße ich allerdings auf ein Problem, dem ich nicht so ganz folgen kann.
Ich nutze derzeit smarty 3.1.15 mit der Erweiterung SmartyML (http://smarty.incutio.com/?page=SmartyMultilanguageSupport)
Soweit bin ich damit auch bestens zufrieden.
Da ich nun aber auch Email-Templates nutzen möchte, wollte ich die Funktion fetch() verwenden.
Gibt in der Doku ja auch ein Klasse Beispiel. Allerdings funktioniert das in meiner Umgebung nicht.
Das Template das ich per $smarty->fetch('email.tpl') lade, wird wie display() angezeigt.
Kann es sein, dass SmartyML die Funktion fetch() "deaktiviert"?
Vielen Dank für eine Rückmeldung.
Grüße
Chris |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Oct 11, 2013 2:19 pm Post subject: |
|
|
SmartyML is nicht kompatibel mit Smarty3.
In der fetch() Methode fehlt der parent Paramter
Code: | function fetch($_smarty_tpl_file, $_smarty_cache_id = null, $_smarty_compile_id = null, $_parent = null, $_smarty_display = false) {
// We need to set the cache id and the compile id so a new script will be
// compiled for each language. This makes things really fast ;-)
$_smarty_compile_id = $this->language->getCurrentLanguage().'-'.$_smarty_compile_id;
$_smarty_cache_id = $_smarty_compile_id;
// Now call parent method
return parent::fetch( $_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_parent, $_smarty_display );
}
|
|
|
Back to top |
|
Backdraft007 Smarty n00b
Joined: 10 Oct 2013 Posts: 2
|
Posted: Tue Oct 15, 2013 8:05 am Post subject: |
|
|
Hi,
danke für die Antwort. So sah meine Funktion aus:
Code: | function fetch($_smarty_tpl_file, $_smarty_cache_id = null, $_smarty_compile_id = null, $_smarty_parent = null, $_smarty_display = false) {
// We need to set the cache id and the compile id so a new script will be
// compiled for each language. This makes things really fast ;-)
$_smarty_compile_id = $this->language->getCurrentLanguage().'-'.$_smarty_compile_id;
$_smarty_cache_id = $_smarty_compile_id;
// Now call parent method
return parent::fetch( $_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_parent, true);
}
|
Warum auch immer im Return ein true für display stand. Habe das nun auf $_smarty_display geändert und scheint zu funktionieren.
Danke nochmal.
Grüße
Chris |
|
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
|