How Modules Work
Management modules are pairs of HTML and PHP files stored in the /manage/ directory. It's possible to have template-specific HTML files for management modules, but there must always be a default HTML file located in the manage directory for the module to fall back on.
For instance if you look in your manage directory right now, you'll see the following two files (among others).
- Code: Select all
advanced_management-settings.html
advanced_management-settings.php
The filenames of both files, other than the extension, must be exactly the same for the module to work. This is a security feature. If either the HTML or PHP file are not found, the module will be ignored and can not be accessed.
Creating New Modules
The easiest way to start a new module is to copy the HTML and PHP files above, and paste them into new files for your module.
You may have noticed that there is a sort of pattern to the names of those files. That pattern is used to determine where in the sidebar the module will show. An underscore is used to separate the group name from the module name, hyphens get replaced with spaces, and the first letters of words get capitalized for the sidebar label.
If you want to create a new module called "Super Power" and have it grouped with the "Wallpaper Management" modules, you would name your new files like the following.
- Code: Select all
/manage/wallpaper-management_super-power.html
/manage/wallpaper-management_super-power.php
Note that you don't have to use the existing groups for new modules. You can have the module display in a new group simply by using a new group name at the beginning of your module files names.
For instance, if you wanted the new Super Power module to appear in a group called "My Group", you would name your files like so
- Code: Select all
/manage/my-group_super-power.html
/manage/my-group_super-power.php
Similarly, the groups of existing modules are not set in stone. If you want a module to appear in a different group, simply change the group name at the beginning of the file names.
Content Generation
Once the module files are in place, the system will start including them in the sidebar immediately. From that point it's just a matter of generating content to assign to the $page->content variable.
If you copied the module files from before to create your new modules files, you should have a basic shell ready to start adding your new functionality. If you're unsure how the templates work, have a look at the Templates Overview.
