Page 1 of 1

Detect installed plugins in .tpl files

Posted: Thu Jan 22, 2009 1:58 pm
by yellowled
I kind of seem to remember asking this before. Sorry if I did :)

Is there any way in a current s9y to check within a .tpl file if a certain plugin is actually installed and active?

If not, we should most definitely have this. Thanks to serendipity_showPlugin, I can emit a plugin at almost any given location in a template. But if I do this and the user doesn't have an active instance of said plugin, the template will emit unnecessary code.

YL

Re: Detect installed plugins in .tpl files

Posted: Thu Jan 22, 2009 2:19 pm
by garvinhicking
Hi!

Yes, through "if (class_exists('serendipity_event_freetag'))" for example. However, you need to register class_exists as an allowed function in smarty through $serendipity['smarty']->register_modifier('class_exists', 'class_exists');.

Regards,
Garvin

Re: Detect installed plugins in .tpl files

Posted: Thu Jan 22, 2009 2:33 pm
by yellowled
garvinhicking wrote:Yes, through "if (class_exists('serendipity_event_freetag'))" for example. However, you need to register class_exists as an allowed function in smarty through $serendipity['smarty']->register_modifier('class_exists', 'class_exists');.
I supposed I'd do this in the template's config.inc.php? Anywhere or should it go in a specific place there?

YL

Posted: Thu Jan 22, 2009 6:52 pm
by judebert
It can go anywhere in there.