I’ve developed quite a few little plugins and some extension hooks but generally I try yo use EEs built in functionality.
But I’ve embarked on something that templates can’t handle and I’m building a fairly complex module and using many of EEs built in classes. It’s been quite fun 😊
I have a requirement where I need to use text data that’s stored as Markdown. I’ve got a plugin to handle this in templates. In my module I don’t want to run the text through the template parse just to invoke the plugin, it would be much more efficient just to run the Markdown code.
As the code is already there how do I use this plugin’s functionality in my Module? Basically how do I access it’s methods?
I’m sue this is a noob question but I’m not sure how to access other plugin, module or extension classes from my code.
Thanks
In EE 2.4 take a look at the system/expressionengine/libraries/Template.php starting at line 1212. This is how EE handles changing the load paths when it comes across custom plugins and modules in the templates so that those addons will have access to their models, views, etc. when their code gets executed. You can do the same thing in your own addon to temporarily change the load paths so you can access other addons models, views, etc.
Thanks Bhashkar. That seems the simplest way of doing it.
I’ve just included the whole plugin code (ie include_once), created a new instance and I’m away using the objects methods. I guess there’s no ‘official’ way of doing this.
So far there’s been no problems and it’s working 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.