2. Overview
Objective
Learn how to build a plugin-in ProdigyView.
Requirements
Installed version of ProdigyView with a database
Understanding of the overview of plug-ins vs applications
Understanding of how to install a plug-in
Understanding of the DEFINES
Estimated Time
12 minutes
www.prodigyview.com
3. Follow Along With Code
Example
1. Download a copy of the example code at
www.prodigyview.com/source.
2. Install the system in an environment you feel comfortable testing in.
3. Proceed to plugins/HelloWorldPlugin.php
www.prodigyview.com
4. Plugin Structure
The structure of a plug-in is very easy to build because a plug-in
does not have a structure. When building a plug-in, all you
need to do is put contents in the entry file specified in the
installation. Plug-ins can be
Procedural Code
Objects/Class
An add-on to an object/class
HTML
6. Procedural Function
The function in the file is a straight procedural function. Once
included, it can be called anymore in your code.
7. Extending Validation
The second part of the plugin is creating an anonymous
function and adding a custom rule to the PVValidator class. If
you are unsure of how this work, reference the tutorial on
Custom Validation.
8. Switch Files
Now to see the plug-in in action, first make sure it is
installed. Read the tutorial on installing a plug-in if you are
are unsure how. Then we can head over to our example
file.
10. PVBootstrap::bootSystem
Calling the bootSystem method will call another method in the
bootstrap called loadPlugins that will include that plug-ins that
are enabled.
We also do not want to initialize the validator or it will overwrite
our rule.
11. Calling the Procedural
Function
First thing we can test is called the procedural function.
And to do that, all we have to do is call it.
Remember that because this function is procedural, it is a
callable from anymore in the code. Be careful when
making many procedural functions in plug-ins because
name conflicts can occur.
12. Validator Test
Our next test is see if our rule was added in the validator.
Pass some values in and see if it validates.
That’s all there is to plug-ins. Very easy to install and use.
13. API Reference
For a better understanding of plug-ins, visit the api by
clicking on the link below.
PVPlugins
More Tutorials
For more tutorials, please visit:
http://www.prodigyview.com/tutorials
www.prodigyview.com