Simple Way to Find If Module Exists? [solved]

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
kendo451

Simple Way to Find If Module Exists? [solved]

Post by kendo451 »

I can write my own UDT to find out if a module is installed.

But, is there an already existing way?

I've scoured the forums and docs and haven't found notice of any. I just thought I would check here...
Last edited by kendo451 on Wed Apr 20, 2011 8:25 pm, edited 1 time in total.
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Simple Way to Find If Module Exists?

Post by Wishbone »

Code: Select all

$gCms = cmsms(); //global $gCms;
  if( !isset( $gCms->modules['TheModuleIWant'] ) || !isset( $gCms->modules['TheModuleIWant']['object'] ) )
    {
       return;
    }
  $themoduleiwant = $gCms->modules['TheModuleIWant']['object'];
  $themoduleiwant->DoThis($somedata);
  $themoduleiwant->DoThat($somemoredata);
http://wiki.cmsmadesimple.org/index.php/Developers_FAQ
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Simple Way to Find If Module Exists?

Post by RonnyK »

or use CGSimpleSmarty....

Code: Select all

{if $cgsimple->module_installed('FrontEndUsers')}Found FEU{/if}
Ronny
kendo451

Re: Simple Way to Find If Module Exists?

Post by kendo451 »

Thanks both of you! Ronny, your method is what I was looking for.
Locked

Return to “CMSMS Core”