The model

The model

What are model files?

Model files contain the settings and database model of a part, layout and theme.
The model file (model.php) contains an PHP array with values. This array must always be named $aModel. These values are used in the back-end and front-end and are important for requesting the users data. Setup files can be used in the main theme folder, the layout folder and in the various parts folders.

The header

The header contains the global data like type and name.

Types of setup files are :
  • layout : this is the only type that can contain the rest of the types that are described below.
  • part : this is a single page.
  • list : this is an user ordered list.
  • news : this is a list of dates sorted from new to old.
  • agenda : this is a list sorted from old to new.
Further header settings are :
  • noindex : don't index the layout / part.
  • offline : turns a part on- or off-line.
  • meta : shows the metadata fields discription and keywords.
  • date : turns the datefield on or off.
  • copy : copies the scripts, template and or settings from an other part / layout.
  • copycontrol : if set to true and two control files exist (one of the copy path and one in the current path) then both controller files will be executed.
  • add : works only with the type list if set to last ('add' => 'last') the new item is added after the last. Default is first.

The copy setting :
The copy setting is a very useful function. With this setting you can copy one part to an other part. For example you want to use the same layout template in the layout news and agenda. Well thats easy, just use the copy setting. In this case the setting would be: 'copy' => 'news'. If you wanted to copy the part banner in agenda then the header of the agenda part would contain the following copy setting: 'copy' => 'news/banner'.

Further more note the the model file in the copy request header will be extended / merged with the copy model file. If there is no view or control file in the request path then the ones in the copy path are used. However, if the option copycontrol is set to true then both control files are executed.

Example of a header :

$aModel = array (
     'name' => 'Page',
     'type' => 'layout',
     'fields'  => array ( ...

The theme header

The theme model file (the model file that is located in the root) is different from the rest of the model files and can contain the following extra options:

  • version : contains the theme version number. Current theme version is 1.
  • mobile : can be set true or false.
  • purify : set false if you don't want to use the auto HTML purifier.
  • compact : set false if you don't want the HTML code to be compact.
  • onecss : set true if you want to compile all CSS into one file.
  • onejs : set true if you want to compile all JavaScript into one file.

A proper theme model file will start like this: 

$aModel = array (
    'name'    => 'The theme name',
    'version' => 1,
    'mobile' => true,
    'fields'  => array ( ...

The fields

The fields

After the header is set the fields of an layout / part can be set. There are several field types that can be used in an setup file. Depending on the field type different settings can be set.

Standard settings are :
  • requered : true / false or 1 / 0
  • minimal : minimal characters requered
  • style : extra css styles
  • width : the width of an field element.
  • info : shows an info box when hovering with the mouse over an element.

Every field starts with a key value that contains an array of settings. This key needs to be unique else it overrides the other with the same key.

Example: 'key_value' => array (settings_array)

String, number, url and email

String, number, url and email are all single lined input fields. The difference between these types is the way the are validated. A field of the type email must contain an email address, an url a website, a number a valid number and a string every character. Example of an email field:

'email' => array (
    'title' => 'eMail',
    'type'  => 'email',
    'size' => '120',
    'requered' => true


Text fields contain plain text without HTML styling. Example of a text field:

'intro' => array (
    'title' => 'Intro',
    'type' => 'text',
    'rows' => '5'


Html fields are similair to the text fields with the difference that they contain text with HTML styling. This means that besides inputting text their is the option to style the text. For example the text in this topic has been edited by an html field. Standard the HTML field will be cleaned on submitting. If you do not want to clean the HTML use the setting 'options' => 'noclean' Example of an html field:

'text' => array (
    'title' => 'Text',
    'type' => 'html',
    'style' => 'height:400px;',
    'required' => true


The file type lets you select a file. If needed you can limit the files type by entering their extensions separated with comma in the options tag. Example of a file type :

'banner' => array (
    'title' => 'Banner',
    'info' => 'The banner image is automatically being cropped to a width of 720px',
    'type' => 'file',
    'options' => 'jpg,jpeg,gif,png'


The type select generates a drop-down select box. Important for this field type is the tag options. Options needs to contain an array of values. The array can be with or without a key. Example of a select field:

'style' => array (
    'title' => 'Style',
    'info' => 'Sets the colors of the banner',    'type' => 'select',
    'options' => array(0=>'Color',1=>'Black / white')

Type and layout

The types type and layout can be used to link different data with each other. These field types are listed like a select type. Only the field options contains different values. If the field is of the type layout options contains the types op layouts that can be used in the select. These types are separated by a comma.

For example: 'options' => 'page,blog'

If the field type is type then options contains the type of layout that can be linked.

For example:'options' => 'list,agenda'

The key / value of the select contains the id of the data that has been selected. Example of a layout field:

'disclaimer' => array (
    'title' => 'Disclaimer info',
    'info' => 'Select the disclaimer page',
    'type' => 'layout',
    'options' => 'page'


The dualselect type displays two lists. The left side is a list of options to select the right side is the list of selected items. Unlike the select, dualselect offers the option to select more then one item. Example of a dualselect field :

'groups' => array (
    'title' => 'Style',
    'info' => 'Select the disclaimer page',
    'type' => 'dualselect',
    'options' => array('1 - 10','11 - 20','21 - 30','31 - 40','41 - 50'),
    'requered' => true


The type checkbox creates a simple checkbox. When selected the value is true else it is false. Example of a checkbox field :

'textshow' => array (
    'info' => 'Shows the text block',


Location creates a location picker that gives the user the option to select a location on a map by dragging a point or searching an address. Example of a location field :

'location' => array (
    'title' => 'Location',
    'type' => 'location'


Colorpicker creates a colorpicker that gives the user the option to select a RGB color. Example of a colorpicker field :

'color' => array (
    'title' => 'Color',
    'type' => 'color',
    'value' => '#0080FF',
    'required' => 1

Datetime, Date, Time and Month

For date input fields use the field types : datetime, date, time and month. Datetime contains the date and time, date only the date, time only the time and month the month and year. Example of a date field :

'birthday' => array (
    'title' => 'Birthday',
    'info' => 'Please enter your date of birth',
    'type' => 'date',
    'required' => 1


The field type password creates a password input field. Example of the password field :

'password' => array (
    'title' => 'Password',
    'info' => 'Please enter a password of minimal 6 characters',
    'minimal' => 6,
    'type' => 'password',
    'required' => 1


The echo type doesn't have any effect on the database and is only used for placing extra information / text in the CMS / back-end. For example to explain what a specific part does. Value contains the text of the echo type. If you want to use the left and the right side like the input fields, use besides the value the title tag. Example of an echo field :

'extrainfo' => array (
    'type' => 'title',
    'value' => 'Some extra information about this form...'


Like the echo type the title type is used only for informational purpose. Example of the title type :

'title_contact' => array (
    'type' => 'title',
    'value' => 'Contact information'