My first template

Getting started

How to write your first template that actually works (more or less)

If the template system appears intimidating at first, it is because it offers a range of rich features which demand some complexity. However, complex doesn’t necessarily mean complicated. Here is an example of a basic template.

Materials necessary for this tutorial

-  A SPIP installation. This article assumes that your SPIP database contains at least one section and two published articles. If this is not the case, you can very quickly fix it by copying and pasting any text which you might have available (within sensible limits).

-  A text editor to create and modify the files used by SPIP. It really is preferable to use a traditional text editor such as Windows Notepad.


Within the root of the site, create a directory called squelettes/ and within that, a file called tutorial.html containing the following code:

<BOUCLE_article(ARTICLES){id_article=1}>
	#TITRE
</BOUCLE_article>

When you load http://yoursite.net/spip.php?page=tutorial, in place of #TITRE, you should now see the title of your first article (Article No. 1) which SPIP fetched from the database.

If it doesn’t work, check that the status of article no 1 is "published online" and not "submitted for evaluation" or "editing in progress".

Next, add some HTML markup and some other calls to SPIP "fields", and you can quickly display your article no 1:

<BOUCLE_article(ARTICLES){id_article=1}>
	<h1>#TITRE</h1>
	<b>#CHAPO</b>
	<div align="justify">#TEXTE</div>
</BOUCLE_article>

Finally add any missing fields to refine the display of the article: #SURTITRE, #LESAUTEURS, #SOUSTITRE, #NOTES, etc.

Well done!

Author Paul Knight Published : Updated : 17/04/23

Translations : عربي, català, corsu, Deutsch, English, Español, فارسى, français, italiano, 日本語, Nederlands, òc lengadocian, polski, Português, русский, slovenčina, svenska, Türkçe, українська