Widget system: Difference between revisions
No edit summary |
|||
| Line 20: | Line 20: | ||
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 you module: | ||
* Go into page [[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 you module descriptor is created, edit it to add lines to declare your box | ||
Revision as of 11:01, 27 July 2013
A box is a file placed into a particular directory and that allows to add new informations in a rectangular area on some pages like the home page.
Create a new box
Every standard box is stocked inside the directory htdocs/core/boxes. There is one file for each box.
Each file is a PHP class that herits the class ModeleBoxes.
To create a new box, copy an existing box file and rename it. Then change its content to match the new name and to define informations you want to show by 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:
- Go into page Module development to know how to create a module
- Copy the box file into htdocs/mymodule/core/boxes/
- Once you module descriptor is created, edit it to add lines to declare your box
$this->boxes[0]['file'] = "box_file.php";
$this->boxes[0]['note'] = "My notes";
$this->boxes[0]['enabledbydefaulton'] = 1;
Activate a box
To activate a box, go on page Home - Setup - Boxes and click on activate on box you want to see. The page will appears on page for which you activate the box.