Templates are assembled slightly differently depending on whether you are viewing an admin panel controller (extending InvController) or a CMS content document / public controller (extending InvPublicController).

InvController (admin panel) template assembly.

In InvController, templates are assembled like a sandwich:

$this->top_template - the standard header template
$this->view_template - your controller's template, loaded using the $this->getTemplate() method
$this->bottom_template - the standard footer template

The $this->getTemplate() method

dotAdmin view templates are loaded using the getTemplate method. This attempts to to load the template from a number of different locations.

It is called as follows:


For a standard (ie: an admin panel) controller, the load order is as follows:

  1. [SITE_PATH] . [SELECTED THEME] . $path/to/templatefile . '.html'
  2. [THEME_PATH] . 'default/' . $path/to/templatefile . '.html'
  3. [MODULE_PATH] . [ANY_INSTALLED_MODULE] . 'view/' . $path/to/templatefile . '.html'
  4. [SHARED_PATH] . 'view/' . $path/to/templatefile . '.html'

CMS content and InvPublicController template assembly.

CMS content is assembled like an onion in concentric layers, starting from the outside and working inwards. First we load the $this->document->getValue(' template') property (usually 'default') and then this determines what happens next. Other templates are then loaded by the template in whatever sequence is specified by that template.

The standard pattern of behaviour is as follows:

  • Load $this->document->getValue('template').html (usually 'default'), within which we usually do the following...
    • Load default_top.html
    • Does $this->document have a content_template?
    • Yes:
      • Load $this->document->getValue('content_template').html
    • No:
      • Load default_content.html, within which we do...
        • Does $this->document have a process_template?
        • Yes:
          • Load $this->document->getValue('process_template').html
        • No:
          • echo $this->document->getHTML('document_content') into the template
    • Load default_bottom.html

The innermost part of this sequence is the important part when it comes to public website controllers extending InvPublicController. The default behaviour of these controllers is to create dummy document which has a document_title, a template, and a process_template property. This is done automatically using the following method in InvPublicController:

protected function createDummyDocument(){
	require_once(MODEL_PATH . 'dummyfile.class.php');
	$this->document = new InvDummyFile;
	$this->document->hnode = InvNode::getInstance();
	$this->document->updateValue('document_title' , $this->view_title);
	$path = $this->interfaceId;
	if(isset($this->path_info) && is_array($this->path_info)){
		foreach($this->path_info as $item){
			$path .= '/' . $item;
	$this->document->updateValue('document_path' , $path);
	$this->document->updateValue('template' , 'default');
	$this->document->updateValue('content_template' , 'default_content');

As you can see, this:

  • sets the document title from the $this->view_title property of the controller,
  • sets the template to "default",
  • sets the content_template to 'default_content'
  • uses the $this->setTemplate() method to set the process_template value to $this->view_template.

This allows a public controller to be assembled in the same order as a standard CMS document, using the same templates, by placing the output of the Controller into a $this->document object.

Contact Us

Address: 22a Fishergate York, YO10 4AB · Tel: 01904 636677 · Email: info@dotadmin.com