Documenation
Controllers
Each page consists of a Controller (logic, PHP code) and a View (presentation, HTML code).
Example Controller (/index.php)
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
<?php
$contrSetup = array(
'rootPath' => './',
'pageTitle' => 'Hello world'
);
require($contrSetup['rootPath'] . '_model/init.php');
$model->check_dependencies(array('db')); // Use if database access is needed
$view->hello = 'Hello world!';
$view->load('index.html.php');
$model->end();
?>
Example View (/_view/index.html.php)
1
<p><?php echo $view->hello ?></p>
Setup
The $contrSetup array needs to be defined at the top of the Controller file.
List of possible keys
-
rootPath(required)
Relative path to the root, i.e../or../../. The root path can not be empty, and should never be set to/(this defeats the purpose of the root path and can break the installation if it's moved to another directory). -
pageTitle
The title of the page as displayed in the browser's title bar. -
pageDescription
Description of the page (for search engine optimization). -
pageKeywords
Keywords relevant to the contents of the page (for search engine optimization). -
inAdmin
Used for administrative pages. -
standAlone
If set toTRUEthe "header" and "footer" hooks will be excluded.
All the defined keys are available as a variable of the $contr object (i.e.
$contr->rootPath).
After $contrSetup the /_model/init.php file needs to be included.
$model->check_dependencies() can be used to check if any required plugins are ready. If not ready,
an error message will be displayed.
At the end of the Controller, the $model->end() function need to be called.
Class
$contr
Public variables
-
$contr->rootPath
Relative path to the root (e.g../). -
$contr->absPath
Absolute path to the root (e.g./). -
$contr->pageTitle
Title of the page. -
$contr->pageDescription
Description of the page. -
$contr->pageKeywords
Keywords relevant to the contents of the page. -
$contr->standAlone
If this variable is set toTRUEthe header and footer hooks will not be executed. -
$contr->inAdmin
Used for administrative pages.