Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > The #ENV environment

The #ENV environment

We use the word environment to define the combined collection of variables that are passed to a particular template. We may also sometimes speak about a compilation context.

For example, when a visitor requests to see article 92, the article identifier (92) is passed to the article.html template. Within that particular "squelette" template, it is possible to retrieve the value of that variable using a special tag: #ENV. In this way, #ENV{id_article} would display "92".

Some parameters are automatically passed to the template, like the current date (when the page is actually generated or refreshed), which can then be displayed using #ENV{date}. Similarly, if we call a template with arguments using the page’s URL, they will also be passed into the environment.

Example

The URL spip.php?page=albums&type=classic will load up the albums.html template. Within that template, #ENV{type} enables you to retrieve the value that was passed, which in this case is "classic".