Developer Area/HowToWriteAViewTemplate: Difference between revisions
From Mahara Wiki
< Developer Area
Brettwilkins (talk | contribs) (Created page with "Mahara will look in DATAROOT/templates and LIBROOT/templates. Each template should live in its own subdirectory within either of these two locations. Mahara will give preference …") |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
Config.php is a small amount of php to describe the template, like so: | Config.php is a small amount of php to describe the template, like so: | ||
<u>StdClass</u>[http://old.eduforge.org/wiki/wiki/mahara/wiki?pagename=StdClass&action=create ?] | <u>StdClass</u>[http://old.eduforge.org/wiki/wiki/mahara/wiki?pagename=StdClass&action=create ?]; | ||
$template->title = 'Example template'; | $template->title = 'Example template'; | ||
$template->description = 'Very rough proof of concept example template'; | $template->description = 'Very rough proof of concept example template'; | ||
$template->category = 'resume'; (see | $template->category = 'resume'; (see <span class="wikiunknown"><u>ViewTemplateCategories</u>[http://old.eduforge.org/wiki/wiki/mahara/wiki?pagename=ViewTemplateCategories&action=create ?]</span>) | ||
?> | ?> |
Latest revision as of 18:15, 12 Mayıs 2011
Mahara will look in DATAROOT/templates and LIBROOT/templates. Each template should live in its own subdirectory within either of these two locations. Mahara will give preference to templates in DATAROOT over LIBROOT, as this will allow customising templates.
Each subdirectory must contain two files:
fragment.template
config.php
Additionally, it is recommended to also include:
thumbnail.(png|gif|jpg|jpeg)
fragment.css
Config.php is a small amount of php to describe the template, like so:
StdClass?; $template->title = 'Example template'; $template->description = 'Very rough proof of concept example template'; $template->category = 'resume'; (see ViewTemplateCategories?) ?>
fragment.template is a fragment of HTML with some extra tags to designate blocks. The HTML should contain everything up to and not including
tags.
The tags to designate blocks look like so:
{{block type="" format="" id="" width="" height="" defaulttype="" defaultformat=""}}
the id attribute is the only one that is required.
width and height are optional, and if given, whatever is dropped into these blocks must somehow fit itself to these constraints.
type/defaulttype are optional and correspond to the name of an artefact type.
format/defaultformat are optional and are one of:
label listself listchildren renderfull rendermetadata
These types are discussed in ViewTemplates.
Types and formats cannot be given without eachother.
fragment.css is a snippet of css that will be inserted into the view.
thumbnail.(jpg|jpeg|gif|png) is the thumbnail to display to the user in the template selection screen of Create View