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
Home page > English documentation > Webmasters > Page layout: reference manual > Tags available throughout the site

Tags available throughout the site

April 2004 — updated : 12 April

All the versions of this article:


Some tags can be used anywhere in a template, even outside of loops.

Tags defined on the “Site configuration” pages

The contents of these tags are defined in the editing area, when you configure your site.

-  #NOM_SITE_SPIP diplays the name of the site.

-  #URL_SITE_SPIP is your site’s address. As the tag doesn’t include the final slash “/”, you can create a link by typing something like #URL_SITE_SPIP/sommaire.php.

-  #DESCRIPTIF_SITE_SPIP (from SPIP 1.9) displays, as indicated by its name, the site description, as it has been entered on the configuration page.

-  #EMAIL_WEBMASTER is the webmaster’s email address. By default, SPIP takes the address of the first administrator, i.e. the one who installed the site. If you’d rather have a “Write to the webmaster” form, see “Forms”.

-  #LOGO_SITE_SPIP [SPIP 1.8] is the site logo. In fact it is the logo of the root section of the site, section 0.

-  #CHARSET is the character encoding used by your site. Its default value is iso-8859-1, i.e. “ISO-Latin-1”. For an introduction to charsets, see Character encodings.

-  #LANG SPIP 1.7, 1.7.1, when used outside ARTICLES, RUBRIQUES, BREVES and AUTEURS loops, gives the main site language.

-  #LANG_DIR, #LANG_LEFT, #LANG_RIGHT SPIP 1.7, 1.7.1 are tags which define the writing direction of the current language. See: Creating a multilingual site for further details.

-  #MENU_LANG (and #MENU_LANG_ECRIRE) SPIP 1.7, 1.7.1 display a language menu allowing a visitor to switch to the current page in the chosen language. The first tag displays the list of languages used on the site, the second is the list of languages of the private area (this list is used on the login screen).

Layout tags

-  From SPIP 1.9, the tag #CHEMIN{xxx} gives the complete path to a file xxx, whether this file is at the root of the site, in the templates directory, in dist/, etc. Use like this, for example:

(Note: This tag replaces #DOSSIER_SQUELETTE which was introduced by SPIP 1.8.2.)

-  #PUCE displays a bullet like the one on the left.

-  #FORMULAIRE_ADMIN is an optional tag used to change the position on the public site of the administration buttons (“Refresh this page”, “Modify this article”, etc.) which are only visible to logged-in administrators. If this tag is in the template, the administration buttons will be displayed in the chosen place, otherwise they will be displayed at the bottom of the page.
N.B. From SPIP 1.8, 1.8.1 the stylesheet spip_admin.css can be used instead to adjust the style and placing of these admin buttons.

-  #DEBUT_SURLIGNE, #FIN_SURLIGNE are tags which indicate to SPIP in which part of the page to highlight words which have been found by a search loop. Voir : «The search loops».

-  The tag #INSERT_HEAD (depuis SPIP 1.9.1) can only be used in templates between the HTML tags <head> and </head>. It allows SPIP and plugins (if any are installed) to add lines in the head section of the HTML page.

Technical Tags

N.B. These tags are for experienced users of SPIP only.

-  #REM does not display anything. It makes it possible to place comments in templates: [(#REM) Ceci est un commentaire. ]. Such comments do not appear in the source code of the pages produced for the site.

-  #SELF SPIP 1.8 gives the URL of the current page starting from the site root. Any variables only needed for SPIP’s internal use are removed. For example #SELF in a page which is called by this URL: http://mysite.net/article.php?id_article=25&var_mode=recalcul would return: article.php?id_article=25

The #SELF tag can be useful in forms. Example:

(Note: #SELF is not compatible with the use of <INCLURE()> (unless the $delais or #CACHE of the included template is set to 0).

-  #URL_PAGE (from SPIP 1.9) gives a "page" type URL (see: Using personalised URLs) for use in a link, using the template passed as a parameter. For example to use the template mypage.html, in your templates directory, use #URL_PAGE{mypage}, which will generate a URL of this form: spip.php?page=mypage. A second parameter can be used to add parameters, e.g.: #URL_PAGE{mypage,id_article=#ID_ARTICLE} will generate: spip.php?page=mypage&id_article=XXX.

-  #ENV{xxxx,zzzz} SPIP 1.8, 1.8.1 returns the variable named xxxx which has been passed in the HTTP request (i.e. a GET or POST variable). It may be a criterion specified in <INCLURE>). zzzz is an optional part which specifies a default value if the variable xxxx does not exist.
By default, #ENV returns a value filtered by htmlspecialchars. This can be overridden in the usual way, by addition of an asterisk to the tag: #ENV*{myvariable}.

Example — In order to set limits to a list of authors:

This loop will display the list of authors who have names corresponding to the regular expression specified in the URL by the variable firstletter (for example, author_list.php?firstletter=^Z) or else, if there is no such variable in the URL, it will display the authors whose names begin with “A”.

-  #SPIP_CRON SPIP 1.8, 1.8.1 has an effect upon the calculations which SPIP carries out behind the scenes to update statistics, the search engine, site syndication, etc. If the tag is not present on the site, SPIP performs these calculations when necessary, after sending a page to a visitor. Unfortunately, PHP does not provide for closing the connection at the end of the page and in some cases, when a longer background task has been triggered — syndication, in particular — there can be a noticeable delay in the page being displayed.
#SPIP_CRON averts this problem. It generates an invisible <div>

with a background property pointing to the script spip_background.php. This script executes the necessary calculations as “background tasks” and sends back a transparent, 1x1 pixel image. This trick alleviates the sense of being held up, by tranferring any slowness to a subsidiary script.
N.B. This tag is not essential, and its presence or absence doesn’t change the regularity of the site’s calculations.

-  #SET{variable,value} and the corresponding tag #GET{variable} were introduced with SPIP 1.9.1. #SET{xxx,yyy} assigns the value yyy to the variable xxx limited to the template in which it is placed. This value can be read by the tag #GET{xxx}. Variables created in this way are not passed to included templates.

N.B. If you assign a value to a variable in the the preceding optional part of a loop, it is not possible to use the variable within the main body of the loop. This is due to the manner in which SPIP calculates templates.

-  #HTTP_HEADER{argument} (from SPIP 1.9) makes it possible to modify HTTP headers in SPIP pages. Example: #HTTP_HEADER{Content-Type: text/css}. N.B. The use of this tag causes the disappearance of the admin buttons. It is not possible to use this tag in templates included with <INCLURE>.

-  #EVAL{argument} (from SPIP 1.9) evaluates the PHP expression placed within the braces. For example, #EVAL{1+1} will display 2, #EVAL{_DIR_IMG_PACK} will display the path to the directory ecrire/img_pack/. N.B. You are strongly advised to use this tag sparingly.

-  #CACHE{time}, from SPIP 1.9, sets the duration for which the page will be kept in cache. The time is in seconds and can be expressed as a calculation For example: #CACHE{24*3600}.


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