templates MyTemplate template.xml

Introduction

This file is optionnal but you should have one to describe at least one zone.

You can describe a template in the file skins/MySkin/templates/MyTemplate/template.xml

Format

<template>
    <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>
    <zones>
        <zone id="..." 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>

Every tag is optionnal but note that at least one zone should be describe to make a template worth.

For label and description, if i18n is false, value is the label. If i18n is true, value is the i18n key in the skin catalogue (or in another catalogue using the following syntax CATALOGUE:KEY)

For thumbnails put you file in the directory resources of your template and insert the path. E.g. "img/thumb_16.png"

Inherit zone contents (new in Ametys 3.1)

Default value: no inheritance

By default, when a zone is empty, it is replaced by nothing on the final website. In this scheme the page 1.1 remain empty.

Simple inheritance

On the <zone> tag you can now use the inherit attribute. Its purpose is to auto fill a zone with the content of its parent page when the zone is empty. In this scheme, both pages are using the same template but the zone "z1" is declared as followed

    <zone id="z1" inherit=""/>

Full inheritance

The inherit attribute can accept several values among this patterns :

  • <nothing> : by letting this attribute empty, this zone will inherit from its parent page in the zone having the same id, as the current zone. If the parent page use a template without a zone defined with this name, this will log an error and nothing will appear.
  • zoneName : by simply entering a zoneName, this zone will inherit from its parent page in the zone "zoneName".
  • templateName->zoneName : this final pattern indicated that if the parent page use the template "templateName", this zone will inherit from the zone "zoneName". You can list several values using comma and you can use the wildcard "*" for all templates. You can finally let the zoneName empty to avoir inheritance for this template.

Samples :

Sample 1
    <zone id="z1" inherit=""/>

The zone "z1" inherit from the zone "z1" of its parent page. To avoid errors in logs, all your templates have to define a "z1" zone.

Sample 2
    <zone id="z1" inherit="z1"/>

Exactly the same as above.

Sample 3
    <zone id="z1" inherit="*->z1"/>

Exactly the same as above.

Sample 4
    <zone id="z1" inherit="z2"/>

The zone "z1" inherit from the zone "z2" of its parent page. To avoid errors in logs, all your templates have to define a "z2" zone.

Sample 5
    <zone id="z1" inherit="t1->z1,t2->z2"/>

The zone "z1" inherit from

  • the zone "z1" of its parent page if this parent page use the template "t1"
  • the zone "z2" of its parent page if this parent page use the template "t2"
Sample 6
    <zone id="z1" inherit="*->z1,t2->z2,t3->"/>

The zone "z1" inherit from

  • the zone "z2" of its parent page if this parent page use the template "t2"
  • nothing if this parent page use the template "t3"
  • the zone "z1" of its parent page on all other cases