How to write a plugin

Plugins are extra components you as the developer can to add to Netharbour to implement new functionality or help make certain items more efficient.
To make a plugin, you need to have 2 files.

  1. plugin.php
  2. config.xml

Below will be an explanation on each of these files.


This is your configuration file. In here you will need to specify:

  • the name of the class your plugin will be using <className>
  • the name of the plugin itself <name>
  • the location in which you want your plugin to be displayed <location>
  • the sublocation if you want it to be a page within an existing page <subLocation>
  • the order in which you want your plugin to be displayed <order>
  • the description for your plugin <description>
  • the version of your plugin <version>


In here I’ve created a Hello World plugin. As you can see location is blanked. There are a few options you can put in there: home, services, devices, clients, statistics. If you put anything else in there, it will be set to default.

Now that config.xml is done, we can start on plugin.php.


This is where you write your actual plugin.
You need to put 1 function in here – get_content($post, $get), and 2 optional function – get_config($id), update_config($value).


First let’s take a look at get_content.

In here are the post and get methods just incase if the user wants to grab his own post and get values. For this Hello World, we have set the greeting property into the property table in MySQL. Therefore, in the get_content() function, we programmed for it to retrieve the data from the table using our existing property class.
The developer may choose to make his own database for his class, but there is a default if the developer wishes to use it.
Afterwards, the developer must make sure to return some kind of content for the html.
Now let’s take a look at get config.

In here is where you make your configuration data. The developer must make sure to have 3 things, the $id as a hidden value so that the application can recognize which plugin is being configured, the naming convention of the value name (Plugin_) so that the application recognizes that this is a plugin configuration, and a plugin_update submit button so that the application can recognize the submission.
In the example, I gave 2 options for the user to choose

  • Hello World!
    Goodbye World!
  • Once the user submits it will go on to the next function, update_config()

    Here is the final place where you can take the post values and update it into either the Netharbour’s property database, or your own database. Afterwards, the user can return a true value back or else Netharbour would not recognize it’s update.
    And that’s in for the basic build of the plugin. For more advance builds, you can visit later as I write them.