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).
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
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:
$this->getTemplate('path/to/templatefile');
For a standard (ie: an admin panel) controller, the load order is as follows:
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:
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'); $this->setTemplate($this->view_template); }
As you can see, this:
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.