arjen Posted July 4, 2013 Share Posted July 4, 2013 I've made a simple module called MarkupBox which is not installed in the CMS, but the files are in the module directory (/site/modules/). When I call the module from a template it returns the value. I suppose there is a way to check if a module is installed, but I can't find it in the code or in the forums. I'm looking for someting like: if ($modules->get("MarkupBox")->isInstalled()) { // Do something } Module: public function render() { $out = "Test"; return $out; } Template: $box = $modules->get("MarkupBox"); echo $box->render(); Thanks! 1 Link to comment Share on other sites More sharing options...
nik Posted July 4, 2013 Share Posted July 4, 2013 You're very close actually . This is how it works: if($modules->isInstalled("MarkupBox")) { // do something } 8 Link to comment Share on other sites More sharing options...
arjen Posted July 4, 2013 Author Share Posted July 4, 2013 It's the other way around Thanks nik! Link to comment Share on other sites More sharing options...
Soma Posted July 4, 2013 Share Posted July 4, 2013 Actually $modules->get("MarkupBox") will install the module if it's not 4 Link to comment Share on other sites More sharing options...
arjen Posted July 4, 2013 Author Share Posted July 4, 2013 Thanks soma for the info. I ran into some issues but realised the module installed itself. My new code: if ($modules->isInstalled("MarkupBox")) { echo $modules->get("MarkupBox")->render(); } 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now