Introduction
This document is intended to be a preliminary overview of the aims of the project: it covers the overall architecture the framework and it explains how the users could use this piece of software in their websites.
Details
- Any website must contain the metas folder, which contains all the necessary code.
- If desired, is possible to edit the metas/config.php file in order to change the default settings. Up now is just possible to set the default template name and the security module which must be used for the authentication procedures.
Final-user pages
Every single page must be a php file which must contain the following code:
include 'metas/page.php';
$metas->begin();
...
$metas->end();
by calling the begin() method the entire framework will be initialized, while with the end() method the final page will be generated. Between these two calls is possible to add some additional calls:
- $metas->loadModule("module_name"); Loads the relative module
Templates
Every template must be put to the metas/templates folder and it must contain at least two different pages:
index.php
This will be the template user for every page. Inside this page is possible to use some php methods, like:
- $tools->getPageName() returns the page in which the template is applied
- $tools->getGet('param') query the page for the presence of a GET parameter and it returns it, if present.
- $tools->getPort('param') query the page for the presence of a POST parameter and it returns it, if present.
- $tools->loadmodules(C_Tools::main_sec) this command will be replaced with the full set of loaded modules.
Up now just these methods are supported
mod.php
This is the template used for every module. Each module has a set of properties which can be queried inside the template:
- $mod->begin() must be called at the beginning of the code
- $mod->end() must be called at the end of the code
- $mod->getTitle() returns the title of the module
- $mos->getContent() returns the code of the module
Modules
Each module must be put to the metas/modules folder and it is represented as a class which inherits from the abstract class base_module. It's mandatory that it inherits the empty constructor and every method:
- function begin() must contain the initialization code BUT it mustn't output anything
- function end() must destroy or close the opened resources
- function getTitle() must return the module name, if desired
- function getContent() must output the module's content