This file is used to define a template and its associated zones. It is located in the directory cms/skins/[skinName]/templates/[templateName] directory.It is optional, but strongly recommended in order to describe at least the"default" zone used by some plugins Ametys files.
template.xml
<template> <label i18n="true|false">...</label> <description i18n="true|false">...</description> <thumbnail> <small>path_to_16px_image_relative_to_resources_dir</small> <medium>path_to_32px_image_relative_to_resources_dir</medium> <large>path_to_48px_image_relative_to_resources_dir</large> </thumbnail> <zones> <zone id="..." inherit="..." type="primary|secondary"> <label i18n="true|false">...</label> <description i18n="true|false">...</description> <thumbnails> <small>path_to_16px_image_relative_to_resources_dir</small> <medium>path_to_32px_image_relative_to_resources_dir</medium> <large>path_to_48px_image_relative_to_resources_dir</large> </thumbnails> </zone> </zones> </template>
All labels and descriptions are internationalizable. The default catalog used is that of the graphic charter located in the cms/skins/[skinName]/i18n/ folder.
Preview images and pictograms must be located in the folder resources/ folder of the template: cms/skins/[skinName]/templates/[templateName]/resources/. They are then called up via a relative path: img/thumb_16.png.
Zones are inherited. By default, zones are not inherited, so if a zone contains no content or services, it remains empty. It is possible to integrate a notion of inheritance that allows, when a zone is empty, to retrieve the contents and/or services of its parent.
To do this, use the inherit attribute on the zone tag. Its value can be :
<zone id="z1"/>
The inherit attribute does not exist, there is no inheritance.
<zone id="z1" inherit=""/>
<zone id="z1" inherit="z1"/>
<zone id="z1" inherit="*->z1"/>
Zone z1 inherits zone z1 from the parent page. To avoid errors in logs, all templates must define zone z1.
<zone id="z1" inherit="z2"/>
Zone z1 inherits zone z2 from the parent page. To avoid errors in logs, all templates must define zone z2.
<zone id="z1" inherit="t1->z1,t2->z2"/>
The z1 zone inherits :
<zone id="z1" inherit="*->z1,t2->z2,t3->"/>
The z1 zone inherits :
Since Ametys 4.6, it has been possible to create a special "sitemap" template (which cannot be assigned to a page).
The sitemap template is automatically assigned to the sitemap root. The root can then be viewed at CMS (and only at CMS), so that zones can be filled in. The advantage is that these zones can be inherited from the sitemap root pages.
For example, I've added the customizable Flux RSS service to the sitemap root in zone 3: it's available as an inheritable service on all pages (with shared customization) in all zones that inherit "sitemap->zone3".
Currently, it's only possible to insert services into the sitemap root.
Not all services work correctly by inheritance, especially from the sitemap root.
When declaring a zone, you can specify its type as an attribute: primary or secondary.
Zones are primary by default.
Primary zones are the main zones of the template. Usually there is only one, but the order of declaration counts otherwise.
There must always be at least one primary zone.
On versions 3.7 and higher ofAmetys, the page creation wizard takes zone type into account when placing the main content/service: they are placed on the first primary.
Similarly, when assigning a new template via the menu, the first primary zone is selected by default.
Default" zone
A "default" zone identifier is always the highest priority.
Thus, for compatibility, 3.5 charters that have no primary zone highlighted but do have a "default" zone will function as expected.
Note that it is always interesting to have "default" as the main primary zone: this is for other functionalities or plugins.
These elements can be set by the user.
Read the next page: View settings
As of Ametys 4.3, it is possible to inherit a charter and therefore its templates.
However, a template file.xml in a child charter simply replaces that of the parent charter.
As of Ametys 4.7, it is possible to inherit certain attributes within a template file.xml by following the documentation below.
As the generic inheritance rule indicates, if the file is absent, the file from the parent charter is used.
If the file is present it will be mixed with the parent chart file according to the following rules:
<template> <parameters> <parameter name="existinginparent-1" type="boolean">...</parameter> <parameter name="existinginparent-2" remove="true"/> <!-- other parameters from parent are kept --> </parameters> <zones> <zone id="existinginparent-1" type="secondary">...</parameter> <zone id="existinginparent-2" remove="true"/> <!-- other zones from parent are kept --> </zones> </template>
By default, inheritance applies, but if the file has the attribute inherit="false", then only the local file is used.
<?xml version="1.0" encoding="UTF-8" ?> <template inherit="false"> ... </template>
From Ametys 4.8
It is possible to have a cms/skins/[skinName]/conf/template-default.xml file in the graphic charter, which will be used as the default value for all template files.xml.
There is the equivalent of an inheritance between these 2 files, so it is possible to use the options described above between these two files.
On the other hand, it's possible to mix this pseudo-inheritance with a classic charter inheritance: in this case, here's the order of operations: