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

SmartyML und fetch()

 
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 -> Language: German
View previous topic :: View next topic  
Author Message
Backdraft007
Smarty n00b


Joined: 10 Oct 2013
Posts: 2

PostPosted: Fri Oct 11, 2013 12:56 pm    Post subject: SmartyML und fetch() Reply with quote

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


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

PostPosted: Fri Oct 11, 2013 2:19 pm    Post subject: Reply with quote

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


Joined: 10 Oct 2013
Posts: 2

PostPosted: Tue Oct 15, 2013 8:05 am    Post subject: Reply with quote

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
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 -> Language: German 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