Developer Area/Core Subsystems/Page Title Template: Difference between revisions
From Mahara Wiki
< Developer Area | Core Subsystems
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
http://dwoo.org/ | |||
http://old.eduforge.org/wiki/themes/gforge/images/http.png | |||
http://mahara.eduforge.org/api/mahara/core/_lib---web.php.html#functionsmarty | |||
http://old.eduforge.org/wiki/themes/gforge/images/http.png | |||
<div class="wikitext"> | <div class="wikitext"> | ||
Revision as of 18:04, 12 Mayıs 2011
http://dwoo.org/ http://mahara.eduforge.org/api/mahara/core/_lib---web.php.html#functionsmarty
All templating in Mahara is done with Dwoo (File:Http.pnghttp://dwoo.org/). Each page that requires templating (which should be all pages that return HTML) will do so by fetching a smarty object via the File:Http.pngsmarty() function (in lib/web.php).
Template Locations
The smarty object returned searches for templates in /theme//templates/ where starts at the current theme, and walks up parents until it finds a file (or a theme with no parent and no file causing an error).
Templates for artefacts in Mahara are accessed via a separate resource plugin. Where normal plugins are accessed just with a relative path (e.g. "mycontacts/index.tpl") artefact plugins will use their plugin name in the path (e.g. "arteface:internal:profile/index.tpl"). The template files themselves should be placed in /artefact//theme//
Also, templates for the render() method of an artefact should be placed in the 'render' subdirectory of the artefact plugin's template directory, and should follow the naming convention _.tpl
e.g., /artefact/blog/theme/default/render/blog_listchildren.tpl
Template variables
The following variables are set by the smarty() function for every page and template.
- THEMEURL: The base url for static content
- WWWROOT: The base url for the mahara system
- USER: The user object
- JAVASCRIPT: A list of javascript files to include in the header. This list is passed into this function (see below).
- HEADERS: An array of any further headers to set. Each header is just straight HTML (see below).
- PUBLIC: Set true if this page is a public page
- MAINNAV: Array defining the main navigation
Template functions
The following functions are available for every page and template.
str
str is a custom function that looks up tags and returns an internationalised string.
Attribute Name | Type | Required | Default | Description |
---|---|---|---|---|
tag | String | Yes | n/a | The tag to look up. |
section | String | No | mahara | Section to look up the tag in. |
assign | String | No | empty | If specified, rather than putting the string inline, will put it in this variable. |