SPIP

[ar] [bg] [ca] [cpf] [cs] [da] [de] [en] [eo] [es] [eu] [fa] [fon] [fr] [gl] [id] [it] [ja] [lb] [nl] [oc] [pl] [pt] [ro] [sv] [tr] [vi] [zh] Espace de traduction

Download the latest version of SPIP

SPIP 1.9.2 SPIP 1.9.2

My first template

Getting started

October 2003 — updated : 20 January

All the versions of this article:

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.


Material necessary for this tutorial

-  A SPIP installation. This article assumes that your SPIP database contains at least a 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.

-  A text editor to create and modify the files used by SPIP. Note: some people will automatically want to use Dreamweaver or other graphical (WYSIWYG) software to modify the .html files. However, for simple examples DreamWeaver will complicate the task and might interfere with the code without you noticing [1]. It really is preferable to use a traditional text editor such as Windows Notepad.

To use a template, it is necessary to be able to call it: create a file called tutorial.php3 in the root of your site containing the following lines:

Then test it by entering http://yoursite.net/tutorial.php3 in your web browser. Not very successful, is it? The error message informs you that a file is missing. This is the famous template that we will now create.

Within the root of the site, create a file called tutorial.html containing the following:

When you reload http://yoursite.net/tutoriel.php3, 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 tags and other calls to SPIP "fields", and you can quickly display your article:

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

Well done!

Footnotes

[1] see the French article on Dreamweaver.


ٍShow the template of this page Site created with SPIP | Translation area | Private area