SPIP

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

Download

Highlighting an item in a list

April 2004 — updated on : December 2010

All the versions of this article:

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:

<ul>
<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>
</ul>

which will be displayed like this:

P.S.

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.


Show the template of this page Site powered by SPIP | Translation area | Private area