Documentation 2.x and 3.x

Hello World plugin example

This plugin adds new tab in administration panel with content "Hello world".

This tutorial will show how to create a simple plugin. We will create a plugin Hello World, that belongs to group of plugins Examples.

Step 1 / 4 - create folder structure

First of all we need to create a folders examples and hello_world in ip_plugins folder like that:

  • ...
  • ip_libs
  • ip_plugins
    • examples
      • hello_world
  • ip_themes
  • ...

Step 2 / 4 - create manager class

In hello_world folder create manager.php file. This file is executed when we open a plugin tab in administration area.

Put this content to manager.php file:

<?php

namespace Modules\examples\hello_world; //"examples" and "hello_world" should exactly match your folder names.

if (!defined('BACKEND')) exit; //this file can be acessed only in backend

class Manager{ //don't change this line.

  function manage() { //this function is executed every time, when plugin tab is opened. This function should return plugin management HTML.
    return 'Hello World';
  }
}
?>

Step 3 / 4 - preapre for installation

In hello_world folder create install subfolder and place plugin.ini file with content:

version:1.00
module_title:Hello World
module_key:hello_world
module_group_title:Examples
module_group_key:examples
module_managed:1

module_key and module_group_key should match folder names that were created in step 1.

module_managed configuration value tells the system that this module have a management area (if set to 1). Set it to 0 if your plugin don't need a tab in administration area.

If your plugin requires another plugin to be installed first, add this line at the bottom:

required_module:plugin_group/plugin/1.00

Step 4 / 4 - installation

Login to administration area, go to tab Developer->Modules and press install. Then refresh browser (press F5) and you will see new tab Examples. Press it and then press Hello World. You should see a text Hello World on your screen.

Hello World plugin example with ImpressPages CMS

Download

You can download this example as an archive. Upload folder examples to folder ip_plugins on your server and execute actions described in step 4.

Write a comment

You must be logged in to comment.