Changing shared template of application

Your application would usually have a consistent look throughout all pages. This look is defined by a "shared" template. This template is used by the Api class and its content will appear on all pages produced by Agile Toolkit.

It was already mentioned that you can change or completely replace this template. You should, however, put some of the important tags back into the template, such as: Content, js_include, document_ready, page_title, and version. If you don't want certain tags to be displayed, comment them inside HTML, prevent them from being added or destroy() them after they are added.

Conditional templates

At the time when defaultTemplate is called, some of the initialization has been done. You can rely on $this->page to determine which page is being requested and based on this information return name of the template. Below code will use templates/default/index.html instead of templates/default/shared.html for the index page.

if($this->page=='index')return array('index');
return 
parent::defaultTemplate();

Do not confuse this with page templates. This replaces API templates and should not be located inside "page" folder.

WARNING: If you will NOT add <?Content?> into your shared template...

Conditioning based on authentication status

defaultTemplate() is called before init(), therefore if you define any authentication in the application, it will not be ready yet by the time API's template is initialized.

If you need to change something on your pages for logged-in users, then do it inside initLayout() function by either adding views or adding login for or just manipulating API's template.