Widget system: Difference between revisions

m
mNo edit summary
Line 13: Line 13:
There is one file for each box.
There is one file for each box.


Each file is a PHP class that herits the class '''ModeleBoxes'''.
Each file is a PHP class that inherits the class '''ModeleBoxes'''.


To create a new box, copy an existing box file and rename it,for example into '''box_myownbox.php'''.
To create a new box, copy an existing box file and rename it,for example into '''box_myownbox.php'''.
Then change its content to match the new name and to define informations you want to show by the box.
Then change its content to match the new name and define informations you want to show through the box.


However if you plan to distribute your box to other users, you should instead create a module and store your box files into you module:
However if you plan to distribute your box to other users, you should instead create a module and store your box files into your module:
* Go into page [[Module development]] to know how to create a module
* Go into page [[Module development]] to know how to create a module
* Copy the box file into '''htdocs/mymodule/core/boxes/'''
* Copy the box file into '''htdocs/mymodule/core/boxes/'''
* Once you module descriptor is created, edit it to add lines to declare your box
* Once your module descriptor is created, edit it to add lines to declare your box
<source lang="bash">
<source lang="bash">
$this->boxes[0]['file'] = "box_myownbox.php";
$this->boxes[0]['file'] = "box_myownbox.php";
304

edits