How to create a plugin?

How to create a plugin

GenIECMS plugin can start as a simple file with a PHP function. All plugins are being installed in /GenIECMS/plugins. The only requirement for a plugin is that the foldername has to be the same as the menu name and index.php php file should be available inside the plugin folder.

/GenIECMS/plugins/{pluginname}/index.php
/GenIECMS/plugins/{pluginname}/tool.php

Hello World! Plugin

/GenIECMS/plugins/hello/tool.php
  1. Creat hello directory inside the plugin directory
  2. Place following index.php file inside hello directory
<?php
//index.php
$subdir_arr = explode("/", $_SERVER['REDIRECT_URL']);
$mennu_arr = explode("<br />", $c['menu']);
$menu_exist = false;
for ($search_num = 0; $search_num < count($mennu_arr); $search_num++) {  
    if (trim(strtolower($mennu_arr[$search_num])) == strtolower($subdir_arr[count($subdir_arr) - 1]) ||      
    trim(strtolower($mennu_arr[$search_num])) == "-".strtolower($subdir_arr[count($subdir_arr) - 1])) {  
        $menu_exist = true;
    }
}
if(strtolower(basename(dirname(__FILE__)))== strtolower($subdir_arr[count($subdir_arr)-1]) && $menu_exist==true){
    $c['initialize_tool_plugin'] = true;
    $c['tool_plugin'] = strtolower($subdir_arr[count($subdir_arr) - 1]);
}
?>

3.) Add tool.php into the hello_world directory

<?php
//tool.php
echo "Hello World!";
?>

4.) Log into the system and add hello into the menu like shown in following figure. https://raw.githubusercontent.com/irusri/GenIECMS/master/docs/images/login_screen.png

4.) Navigate to http://[server name]/GenIECMS/hello https://raw.githubusercontent.com/irusri/GenIECMS/master/docs/images/hello_world.png