A template is modeled by one or more XSL files which, using the XML data supplied by CMS, generate HTML to display the web page to the user.
All templates are defined in a folder named templates (cms/skins/[skinName]/templates). This folder contains as many directories as there are templates. Each directory bears the name identifying the template (page or index, for example). A template folder is made up of static resources, a style sheet(template.xsl) and a definition file(template.xml):
Directory | Details |
---|---|
|
There must be at least one named template, which must contain at least one named zone. These are the default values used by the Ametys application. It is also strongly recommended to have a zone in all templates.
In general, certain elements are identical on all pages (the header and footer, for example); in this case, one or more common XSL files, placed in the cms/skins/[skinName]/stylesheets directory and then imported into the various templates.xsl templates allows you to pool the definition of these elements.
The template-default.xsl file in the Ametys kernel contains predefined templates. These can be overridden in the file cms/skins/[skinName]/templates/[templateName]/stylesheets/template.xsl of a template.
The templates defined in this file are :
By default, the favicon is extracted from the kernel. To define a new favicon for a given project, it is advisable to override this template and define a Apache site-side rule so that the favicon is always available, even when CMS is not running.
It's essential to place favicon files on the site so that the favicon is always available, even when CMS is down.
We recommend overloading the favicon at a XSL common to all templates.
Favico
The favicon must always be defined in two formats: GIF and ICO, as some browsers only support one or the other.
<xsl:template name="favico"> <link rel="icon" type="image/gif" href="{$uri-prefix}/kernel/resources/img/runtime_favico.gif" /> <link rel="shortcut icon" type="image/x-icon" href="{$uri-prefix}/kernel/resources/img/runtime_favico.ico" /> </xsl:template>
Le template head-meta-top permet de définir les balises <meta> dans l'entête de page. Il est possible de définir des métadonnées par gabarit en surchargeant ce template dans le fichier template.xsl d'un gabarit.
By default, jQuery is imported. It is possible to suppress the jQuery import or to complete this import with plugins, by defining the template XSL named head-js-jquery. This is rarely necessary, as most of the plugins jQuery elements required to display a page have already been imported by content and services.
The jQuery prefix is transformed by $j to avoid conflicts with other libraries, so be sure to keep it if you override the template head-js-jquery.
<script type="text/javascript"> $j = jQuery.noConflict(); </script>
The jQuery theme used by default in Ametys is the "lightness" theme.lightness" themeTo import a different theme, define the new import in a template named head-css-jquery.
Pirobox is a library built with jQuery for displaying and zooming images. This library is imported by default into Ametys. To change Pirobox launch parameters, modify the template XSL head-js-pirobox.
Like jQuery, it is also possible to modify only the Pirobox theme, the default"Black" theme, by redefining the template XSL head-css-pirobox.
This template is used to position CSS classes on item-zones. It must return text only.
The default version sets :
These templates are called up inside each zone: before and after the zone.
The parameters are :
These templates are called for each zone-item in the zone: before and after the zone-item.
The parameters are :