Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

check for plugin from template

Quote Reply
check for plugin from template
Hi,

From the user templates, is there a way to check whether a plugin is installed before running some code? Something like this:

Code:
<%if Plugins::search_verts%><%-- search_verts is installed --%>
<%Plugins::search_verts::user_form%>
<%endif%>


Thanks!
Mike
Quote Reply
Re: [Swaylock] check for plugin from template In reply to
I don't believe there is a way from inside the templates. You'd need to call a global, and return a tag.

the plugins.cfg file is just a dump file, a hash of hashes. So, you can load that file, and see if exists the tag(plugin name) you are looking for exists. If so, you can act on that.

<%test_for_plugin ('plugin_name')%>

Then you can just shift the passed param off, and test for it's existence.

return "plugin_exists" and it will have the result of the most recent test_for_plugin call.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] check for plugin from template In reply to
Pugdog,

Good idea. I think I'll give it a try. I'll let you know if I succeed.

Mike