How to include publicly available function with new plugin install

Asked by jsherk

The new ExamplePlugin with v3.0.0-b3 is great except I need an example of how to include a function that would be available to all other plugins upon installation.

Example could be with a very simple function like:
function MYPLUGIN_HiThere() {
  echo "Hi there!";

I need it to include what would go in the plugin.config.xml file as well as the which folder to put the function in.


Question information

English Edit question
PHPDevShell Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Revision history for this message
Best TitanKing (titan-phpdevshell) said :

Hi, I will post proper documentation regarding this soon.

However its, fairly easy. Add the class you want to share in the includes folder of your plugin. Then in your plugin config file simply add your class name, see something like Pagination plugin for example.

Then you can simply call your class with $myClass = $this->factory('someClass');

Remember class name and file name must be same, so it will be : someClass.class.php and class someClass { }

Revision history for this message
jsherk (jeff-forerunnertv) said :

Ok I got it orking now... I was missing the $myClass=$this->factory('someClass') step!


Revision history for this message
jsherk (jeff-forerunnertv) said :

working not orking ... lol

Revision history for this message
jsherk (jeff-forerunnertv) said :

Thanks TitanKing, that solved my question.