This repository was archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Creating Modules
shadow7412 edited this page Sep 14, 2010
·
6 revisions
Modules are different to pages in that nothing is echo’d.
The php in the modules directory should only put down placeholders.
These should confirm to the following layout:
| < div id=“mod-name-placeholder”>< /div> //mod stays as is //name – name of the mod. //placeholder – name of the placeholder. |
This is so that modules do not fight as they all use getElementById().
The php should start a bit like this:
| <?php include_once “../include/module.php”; $m = new Module(1, 2); //1 = name of module, 2 = access required to view ?> |
Then you can add the placeholders:
| <?php $m→addContent(“”mod-example-content\“>”); ?> |
Now place everything where it should be using javascript.
There will be a magical variable called ‘xml’ that will contain the xml for your module. It should be found in the xml directory with the same name as the module itself.
| <?php $m→addJs(document.getElementById(‘mod-example-content’).innerHTML = xml.getElementsByTagName(‘content’)0.childNodes0.nodeValue); |
Voila.
Also, like pages, they need to be put into the database.