Smarty output filter

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

Smarty output filter

Post by ReneSchmidt » Mon Jan 31, 2005 12:39 pm

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?

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smarty output filter

Post by garvinhicking » Mon Jan 31, 2005 3:26 pm

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/

User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 8:34 pm
Contact:

Re: Smarty output filter

Post by ReneSchmidt » Tue Feb 01, 2005 9:29 am

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.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Smarty output filter

Post by garvinhicking » Tue Feb 01, 2005 11:00 am

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/

User avatar
ReneSchmidt
Regular
Posts: 13
Joined: Sat Jan 22, 2005 8:34 pm
Contact:

Re: Smarty output filter

Post by ReneSchmidt » Tue Feb 01, 2005 1:14 pm

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