How to build a new plugin?
These instructions will introduce you how you can install and build a new plugin.
1.) change into directory "plugins" and create a new directory of your own:
i.e. mkdir test
2.) go back to PHPuserFramework and configure file class.config.php to add test.
Add the following line to the array $navilist:
var $navilist = array (
"admin" => "Administration",
"info" => "Informationen", // don't forget to add a comma!!!
"test" => "My Test" // this is the headline of the new menu
);
3.) change to directory plugins/test
Here you must create another directory, i.e. helloWorld
4.) copy plugin template into this directory
You will find a template file called class.template.php in the plugins direcotry. Copy this into the new directory helloWorld;
after that rename this file into class.helloWorld.php.
5.) edit class.helloWorld.php:
- in the file you have copied you will find the keyword TEMPLATE at serveral positions. Rename it into helloWorld.
- edit function getSubrubrik:
function getSubRubrik() {
return "Hello World"; //this is the link that will appear in the menu
}
- edit function getOutput():
function getOutput() {
//#################### ANFANG #################################
$result="Everyone of you knows that typical sentence: Hello world...";
return $result;
//##################### ENDE ##################################
}
/PRE>
Use your browser and browse to the PHPuserFramework. After login you will find a new menu called "My Test"; there is a ne link called "Hello World". If you click on it, the content area will change. You will see the sentence, you inserted above.
Naturally this is only the beginning. Start to connect to a database. Perhaps the class.db.php will help you to manage this. Show some more information about the user that is logged in. For this there is the class user that has automatically added to your class.
|