Page 1 of 1

Smarty output filter

Posted: Mon Jan 31, 2005 11:39 am
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?

Re: Smarty output filter

Posted: Mon Jan 31, 2005 2:26 pm
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

Re: Smarty output filter

Posted: Tue Feb 01, 2005 8:29 am
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.

Re: Smarty output filter

Posted: Tue Feb 01, 2005 10:00 am
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

Re: Smarty output filter

Posted: Tue Feb 01, 2005 12:14 pm
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 :)