Smarty code to detect extension installed or not?

Discuss PivotX 2.0.x here. Non-PivotX related discussions go in The Drain.

Smarty code to detect extension installed or not?

Postby Harm10 » Wed Jan 11, 2012 11:53 am

I post this question in here because I think others could be interested in the answer too.

Is there a simple way to detect in smarty code (think theme templates) whether a specific extension has been activated or not?
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Smarty code to detect extension installed or not?

Postby Schop » Wed Jan 11, 2012 12:55 pm

You can check if a tag exists, like so:

Code: Select all
[[ if tag_exists('nivoslider') ]]
    ...do whatever here...
[[ /if ]]


The above example tells you if 'Nivoslider' is installed, because it creates the [[nivoslider]] tag.
User avatar
Schop
Contributor
 
Posts: 485
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Re: Smarty code to detect extension installed or not?

Postby Harm10 » Wed Jan 11, 2012 3:15 pm

Great! It works.
Thanks for pointing it out.

Is this a standard condition for smarty or a special implemented one for PivotX?
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Smarty code to detect extension installed or not?

Postby Schop » Wed Jan 11, 2012 4:26 pm

It's a Pivotx function, look in pivotx/modules/module_smarty.php
User avatar
Schop
Contributor
 
Posts: 485
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio


Return to 2.x Discussion

Who is online

Users browsing this forum: No registered users and 1 guest