Smarty output filter

Creating and modifying plugins.
Post Reply
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Smarty output filter

Post by ReneSchmidt »

Hi there, hi Garvin :)

Is possible to register smarty output fiters from within an external plugin (not from a template)? I'm reviewing s9y for possibilities but it seems it won't work without changing s9y internal code. Event hooks are being handled before smarty gets involved (that's how I understand the code, please correct me if I'm wrong).

Am I missing something?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smarty output filter

Post by garvinhicking »

Basically you should be able to access the $serendipity['smarty'] object from without your plugins.

You are correct that event hooks are handled before smarty gets involved - but at this point only the collection of event plugins is collected, they are not executed.

So it will work, if you use an event hook which is called later in the code - AFAIR every hook apart frontend_configure should be able to create new smarty modifiers.

Maybe that helps you further? If not, please try to tell me what you want to do, then I can see how/if that is possible. Of course we're willing to expand our API to do what you want, if needed!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Re: Smarty output filter

Post by ReneSchmidt »

garvinhicking wrote:Maybe that helps you further? If not, please try to tell me what you want to do, then I can see how/if that is possible. Of course we're willing to expand our API to do what you want, if needed!
Yes it did!

I've made another plugin. :) It mangles Smarty's output and sanititzes it from whitespace, html comments, tabs, line feeds and so on and reduces output size by about 15-20% (goes for my starting page, YMMV).

BTW I could not find a list of event hooks that are available. If there is a need for that, I could assemble such a list. I had to inspect the code everytime I wanted to know about them... Very annoying.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smarty output filter

Post by garvinhicking »

That sounds like a nice plugin! :-) Care to contribute?

And, yes - a list of available event hooks documented would be really, really cool! I made the "Plugin Api" Documentation (http://www.s9y.org/43.html) writable, so if you like to add those there, feel free! :)

Thanks,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 7:34 pm
Contact:

Re: Smarty output filter

Post by ReneSchmidt »

garvinhicking wrote:That sounds like a nice plugin! :-) Care to contribute?
Sure... I would like to test the plugin some more. I'll let you know when it's done :)
Post Reply