The selection criteria
Use one of the following criteria to control which messages are selected:
- {id_forum}
returns the message identified by id_forum
. As each message identifier is unique, this criterion returns either one message or none.
- {id_article}
returns the messages corresponding to this article.
- {id_rubrique}
returns the messages corresponding to this section. Warning: this does not mean the messages for the articles in this section, but only the messages directly linked to the section itself. This is because the private zone does allow you to enable forums for each section if you so wish.
- {id_breve}
returns the messages corresponding to this news item.
- {id_syndic}
returns the messages corresponding to this site.
- {id_thread}
, returns the messages belonging to the current discussion thread.
Note: id_thread
is simply the id_forum
of the first message in the discussion.
- {id_parent}
returns the messages that depend on the current message, i.e. are lower down in the same thread. This criteria is essential for managing threads in the discussion forums.
- {id_enfant}
returns the message upon which the current message depends, thus allowing you to move upwards in a thread.
- {meme_parent}
returns the other messages answering the same message.
- {plat}
(i.e. “flat”) or {tout}
(i.e. “all”). Returns all (within the limits of the other criteria, of course) forum messages regardless of their hierarchy. Using this criterion, you can, for example, select all the messages whatever their position in a thread. This in turn makes it possible to display messages in strict chronological order. Or this criterion can be used to count the total number of contributions in a forum.
N.B. In the absence of the {id_forum}
or {id_parent}
criteria, when {plat}
is not used, only messages without parents (i.e. at the root of the thread) will be displayed.
- {id_secteur}
returns the messages corresponding to the sector. At first sight, not very useful; but it makes it possible, for example, to build a large forum on a subject by gathering all the messages from a sector.
Keywords may be linked to forum messages. The following keyword criteria can now be used in (FORUMS)
loops:
-
{id_mot}
,{titre_mot=xxx}
return the messages related to the keyword whose number is id_mot or whose title is titre_mot respectively; -
{id_groupe}
,{type_mot=yyyy}
the messages related to keyword group with the identifier of id_groupe, or the title type_mot respectively.
The display criteria
You can use any of the criteria applicable to all loops.
Tags for this loop
Tags read directly from the database
The following tags represent items retrieved from the database. Any of them may also be used as a sort criterion — {par titre}
for example.
- #ID_FORUM
returns the unique identifier of the message.
- #ID_THREAD
, gives the identifier of the discussion thread to which this message belongs. (This is the id_forum
of the first message in the thread.)
- #URL_FORUM
, gives the canonical address of the page showing the message. With SPIP’s normal URLs this would be, for example, /spip.php?article8#forum15
— for message 15 associated with article 8.
- #ID_BREVE
returns the identifier of the news item to which this message is attached. Note, this tag is not recursive: a message which answers a message attached to news item does not itself contain the number of the news item.
- #ID_ARTICLE
is the identifier of the article which the message answers.
- #ID_RUBRIQUE
the identifier of the section which the message answers.
- #ID_SYNDIC
the identifier of the site which the message answers.
- #DATE
is the date of publication.
- #TITRE
is the title.
- #TEXTE
is the text of the message.
- #NOM_SITE
is the name of the website indicated by the author.
- #URL_SITE
is the address (URL) of that website.
- #NOM
is the message author’s name.
- #EMAIL
is the author’s email address, in the form of a direct email link (including the mailto: code). It therefore uses [(#EMAIL)]
so that the email address is shown as well as providing a clickable link to create a new email message to this address.
- #IP
is the author’s IP address when the message was sent.
Tags calculated by SPIP
- #FORMULAIRE_FORUM
displays an interface allowing a reply to be posted. To find out more, please refer to "Forms".
- #PARAMETRES_FORUM
returns a list of the variables needed to create a link to the forum making it possible to answer this message.
It can be used in this way:
[<a href="spip.php?page=forum&(#PARAMETRES_FORUM)">Reply to this message</a>]
This tag can be passed with a parameter detailing the return address to be redirected to after having posted the message. For example:
<a href="spip.php?page=forum&(#PARAMETRES_FORUM{#SELF})">Reply to this message</a>
will return the visitor to the current page once the message has been validated.