Highlighting an item in a list

The #EXPOSE tag is used to highlight, either in a menu or in a list, the main object of the page which the site visitor is currently viewing.

The object which is being "exposed" is the article (or news item, or section, or keyword, or author) which belongs to the current "context". In the case of sections, the breadcrumb hierarchy is generated, which makes it possible to "expose" the hierarchy of the sections that contain the article (or other object) being displayed.

By default, SPIP replaces the #EXPOSE tag with "on" if the object matches that of the context; otherwise the tag returns nothing at all.

However, the #EXPOSE tag can accept either one or two arguments, which allow you to specify what should be displayed for the exposed object, and what should be displayed for all the other objects. As an example, writing [(#EXPOSE{yes,no})] will display "yes" for the exposed object, and "no" for all of the others.

Displaying the exposed article differently

In its simple form, the #EXPOSE tag allows you to change the appearance of the link to the current article differently from other articles in a navigation menu. To modify the style of the links in such a menu, we could insert the #EXPOSE tag in the following manner into the article.html template:

with the following style instructions:

The object which is exposed in the list will then be highlighted by using different style commands

Disabling the exposed link

With a small change to the code, it is also possible to disable the link on the highlighted article as well as changing its appearance:

which will generate the following HTML code, where the <a> tags are replaced with <span> codes instead:

<li><a href="article1.html">All about my sister</a></li>
<li><span class="on">All about me</span></li>
<li><a href="article3.html">All about my brother</a></li>

which will be displayed like this:

Historical note:

This feature was introduced with SP<font color="yellow">IP 1.7.1 using the #EXPOSER tag. The syntax of this tag was as follows: [(#EXPOSER|oui,non)]

This notation is now deprecated. Use #EXPOSE instead, whose syntax is more in line with that of all other SPIP tags.

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

Translations : عربي, català, Deutsch, English, Español, français, italiano, Nederlands, òc lengadocian, Türkçe