Page 1 of 1

Best Practice

Posted: Wed Sep 18, 2019 5:09 am
by HeshanKaru1994
Is it a best practice to write all the business logic(javascript and trigger level php) inside a plugin and importing the plugin to the workspace? (So that the pmx file can be relatively small in size)

Re: Best Practice

Posted: Wed Sep 18, 2019 9:52 pm
by amosbatto
It depends on what kind of code you have. If you want to add PHP functions or PHP classes, then you can create a plugin that uses the option PMFunction class.

Then you can write triggers that calls the functions or classes that you added to the plugin. You can also add image files or other types of files to your plugin and access them with the URL:
http://{your-domain}/plugin/{pluginName}/{your directory}/{your-file}

All of this is a lot of work in my opinion. It is a lot easier to just include all your code and files in the process.