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

Output filter und das Smarty Object

 
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
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Thu Aug 14, 2014 12:25 pm    Post subject: Output filter und das Smarty Object Reply with quote

Hallo alle zusammen,

ich habe einen Output filter registriert der auch gefeuert wird und eigentlich alles tut, was er soll. Jedoch habe ich mit dem zweiten Parameter, dem Smarty Objekt, ein Problem. Wenn ich da z. B.

Code:
$smarty->append('var', 'val');


mache, ist die Variable 'var' im Smarty aber nicht gesetzt bzw. nicht vorhanden (isset prüfung). Was mache ich falsch? Muss ich da was beachten?
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


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

PostPosted: Fri Aug 15, 2014 2:55 am    Post subject: Reply with quote

Ich verstehe nicht was du machen willst. Der Output Filter läuft über den bereits fix und fertig gerenderten Output.
Was soll dass Assign im output filter bewirken?
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Fri Aug 15, 2014 6:01 am    Post subject: Reply with quote

Ja schon klar, dass es schon über den gerenderten Output läuft, aber - korrigiere mich, wenn ich es missverstanden habe - pro Ausgabe bzw. pro Template. Wenn ich also sagen wir mal im filter bei der Ausgabe von template1 etwas "überprüfe" und dann was assigne, was in Template2 "definiert" ist, sollte es doch eig gehen oder nicht?

Für was genau soll denn das smarty-Objekt sonst sein?
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


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

PostPosted: Fri Aug 15, 2014 2:38 pm    Post subject: Reply with quote

Bei meiner Antwort habe ich etwas übersehen.

Der 2. Parameter ist nicht das Smarty Object, sondern das Template Object. Siehe http://www.smarty.net/docs/en/plugins.outputfilters.tpl

Dadurch setzte Dein Assign eine Variable im lokalen Template Kontext und war somit außerhalb des Templates nicht sichtbar.

Im Output Filter müsste es wie folgt lauten:
Code:
$template->smarty->assign();
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