What are the files in that “dist” directory?

Default templates in the “dist” directory, and how to customise templates.

Are you wondering what the files in the “dist” directory are? They are the “default” set of template files provided with the SPIP distribution.

As you already know (if you don’t, please read the Reference Manual), the template system is based on .html files that contain the page layout of the site. For instance, article.html displays articles while rubrique.html displays sections, and so on.

If you adapt the .html files provided with SPIP for your own needs, you need to be careful when upgrading the programme. If you are not careful, your own files can be overwritten by the the new ones.

With [SPIP 1.8] the default template files are stored in the “dist” directory, and this helps avoid the problem just mentioned.

If you want to develop your own layout, place template files — article.html, rubrique.html, etc. — at the root of the site, or better still in a directory named squelettes (which SPIP searches automatically). The next time you upgrade SPIP, only the default templates in the dist directory will be overwritten; you will not lose your customised templates.

Note: The .php3 files corresponding to the .html template files still need to be stored at the root of the site.

From version 1.3 up to [SPIP 1.7.2], the template files included with the SPIP distribution were named article-dist.html, rubrique-dist.html, etc. They could be renamed article.html, rubrique.html, etc. (without -dist) and then customised without risk of being overwritten.

Going Further

The .html files of the templates may be named using a section number in order to use a different layout for a particular section and its articles.

This is the order in which SPIP looks for these customised templates:

-  rubrique=10.html: if this file exists then the template is used for section number 10 only;

-  if that file doesn’t exist, SPIP will look for a rubrique-10.html file. If this file exists, section 10 and its sub-sections use it as well;

-  if that file doesn’t exist, SPIP will look for a rubrique.html file applying to all sections of the site that aren’t called by the above files:

If that file doesn’t exist, then versions up to [SPIP 1.7.2] will use the default rubrique-dist.html file. This mechanism was replaced, from [SPIP 1.8] by the use of the dist directory.

-  exactly the same sequence is applied to article templates: article=10.html, article-10.html, article.html (Note: the numbers are section numbers, not article numbers).

Note: The article about custom variables explains how to store all the site templates in one sub-directory for versions previous to [SPIP 1.8].

Author bealach, Paolo Published : Updated : 26/10/12

Translations : عربي, български, català, Deutsch, English, Español, français, italiano, òc lengadocian, Türkçe