Manages HTML pages and provides functions for rendering them

 Methods

The constructor initializes the class and tries to get the encoding from the currently selected language.

__construct(string $pagename, string $pluginname, string $submenu) 

It will also add every script in the form of /scripts/.PAGENAME.js and every stylesheet in the form of/styles/.PAGENAME.css to the page as well as /scripts/PAGENAME.js and /styles/PAGENAME.css.

Parameters

$pagename

string

The name of the page which will be used to load corresponding stylehseets, templates and scripts.

$pluginname

string

The name of the plugin in which the site is run

$submenu

string

The number of the submenu which should be highlighted when this page is shown.

After calling this the page will only display messages and not render the content template.

abortRendering() 

NOTE: You still have to call render() to actually show any messages

Adds a meta tag to the website.

addMeta(array $meta) : void

Parameters

$meta

array

Associative array with the meta tag attributes

Exceptions

\cInvalidArgumentException if an invalid attribute for the meta tag has been given

Adds a script to the website - path can be absolute, relative to the plugin scripts folder and relative to the CONTENIDO scripts folder.

addScript(string $script) 

NOTE: This function will also add inline JavaScript in the form of "<script...". However this shouldn't be used.

Parameters

$script

string

The filename of the script. It has to reside in /scripts/ in order to be found.

Adds a stylesheet to the website - path can be absolute, relative to the plugin stylesheets folder and relative to the CONTENIDO stylesheets folder.

addStyle(string $stylesheet) 

Parameters

$stylesheet

string

The filename of the stylesheet. It has to reside in /styles/ in order to be found.

Appends all cHTML objects in an array (or a single object) which build up the site instead of a content template.

appendContent(array | object $objects) 

NOTE: All these objects must have a render() method or else they won't be shown

Parameters

$objects

arrayobject

An array of objects or a single object

Displays an error message and aborts rendering after that NOTE: You still have to call render() to actually show any messages

displayCriticalError(string $msg) 

Parameters

$msg

string

A message

Displays an error but the rendering of the content template will continue.

displayError(string $msg) 

Parameters

$msg

string

A message

Displays an info

displayInfo(string $msg) 

Parameters

$msg

string

The info message

Displays a warning

displayWarning(string $msg) 

Parameters

$msg

string

The warning

Calls the next() method on the content template.

next() 

Renders the page and either prints it or returns it

render(\Template | null $template, bool $return) : string

Parameters

$template

\Templatenull

If set, use this content template instead of the default one

$return

bool

If true, the page will be returned instead of echoed

Returns

stringvoid either the webpage or nothing

Applies a value to a key in the content template.

set(string $type, string $key, string $value) 
see \cTemplate::set()

Parameters

$type

string

Either "s" or "d" for "static" or "dynamic" values

$key

string

The key which should be replaced

$value

string

The value which should replace the key

Sets an array (or a single object) of cHTML objects which build up the site instead of a content template.

setContent(array | object $objects) 

NOTE: All these objects must have a render() method or else they won't be shown

Parameters

$objects

arrayobject

An array of objects

Sets the encoding of the website

setEncoding(string $encoding) 

Parameters

$encoding

string

An encoding which should be valid to use in the meta tag

Sets the markscript

setMarkScript(string $item) 

Parameters

$item

string

The number of the submenu which should be marked.

Example: setPluginScript('content_allocation', 'complexlist.js'); $this->_scripts[] = 'http://contenido.local/contenido/plugins/content_allocation/scripts/complexlist.js';

setPluginScript(\unknown_type $plugin, \unknown_type $filename) : \Ambigous

Parameters

$plugin

\unknown_type

$filename

\unknown_type

Returns

\Ambigous

Adds the reload script for the left_bottom frame to the website

setReload() 

setStyleDirect()

setStyleDirect($filepath) 

Parameters

$filepath

Loads the subnavigation of the current area upon rendering.

setSubnav(string $additional, string $aarea) 

Parameters

$additional

string

Additional parameters the subnavigation might need. These have to look like "key=value&key2=value2..."

$aarea

string

The area of the subnavigation. If none is given the current area will be loaded

 Properties

 

$_abort : bool
 

$_contenttemplate : \cTemplate

(Usually template.PAGENAME.html)

 

$_error : string
 

$_info : \unknown_type
 

$_markscript : string

This will be included in the final page.

 

$_metaTags : array
 

$_objects : array
 

$_pagename : string

This will be used to load the template, stylesheets and scripts.

 

$_pagetemplate : \cTemplate
 

$_pluginname : string
 

$_scripts : array
 

$_styles : array
 

$_subnav : string

This will be included in the final page.

 

$_warning : string