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.

Thanks

Question information

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

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 :
#2

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

Thanks

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

working not orking ... lol

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

Thanks TitanKing, that solved my question.