Detect installed plugins in .tpl files

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Detect installed plugins in .tpl files

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Detect installed plugins in .tpl files

Post 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
# 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/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Detect installed plugins in .tpl files

Post 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
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

It can go anywhere in there.
Judebert
---
Website | Wishlist | PayPal
Post Reply