SPIP cookbook

Collection of solved solutions at the most widespread problems while installation website on SPIP. Regulary we introduce new info at this article.

Display of menu subpoint

Display at the base of sections

<li><a href="#URL_RUBRIQUE" [title="(#TITRE|supprimer_numero)"]>[(#TITRE|supprimer_numero)]</a></li>

Menu at the base of articles.

<li><a href="#URL_ARTICLE" title="#TITRE">#TITRE</a></li>

Criteria for the sections which started with digit

Usually, every section has its ordinal number. Except of display configuration, subpoints can be hidden at the same way using this criteria:
{titre==^[[:digit:]]}

Displaying of ligual versions of the site

If every lingual version locates at root directory, we just display languages of these sections.

<div class="language">
<BOUCLE_languages(RUBRIQUES) {racine} {par num titre} {titre==^[[:digit:]]}>
[<a href="#URL_SITE_SPIP?lang=#LANG" [title="#NOM_SITE_SPIP - (#TITRE|supprimer_numero|textebrut)"]>(#LANG|traduire_nom_langue)</a>]
</BOUCLE_languages>
</div>

Functional inclusing with a help of keywords

It si very convenient to use keywords for configuration & behaviour of article. In this example I’ve created group of keywords "Service", and keyword id_mot=1, with a help of which i control displaying of feedback for this article.

<BOUCLE_feedback(MOTS) {id_article} {id_mot=1} {0,1}> #FORMULAIRE_FEEDBACK</BOUCLE_feedback>

Gallery

At once, with lightbox option. Support is provided by rel=lightbox.

<B_gallery>
<h3>Gallery</h3>
<BOUCLE_gallery(DOCUMENTS) {id_article}{extension==jpg|png|gif} {mode=document} >
<div class="gallery-item">
[<a href="#URL_DOCUMENT" title="#TITRE" rel="lightbox">(#LOGO_DOCUMENT|image_reduire{150,0})</a>]
</div>
</BOUCLE_gallery>

Access to the element from external requestа

Key moment - #_rubs:TITRE,this tag displays #TITRE of section from cyclePath _rubs.

<BOUCLE_rubs(RUBRIQUES)>
 <ul>
   <BOUCLE_arts(ARTICLES){id_rubrique}>
     <li>#_rubs:TITRE - #TITRE</li>
   </BOUCLE_arts>
 </ul>
</BOUCLE_rubs>

Path

Path to the current pagr (section). Easily to convert on article.

<div class="pathway">
<a href="#URL_SITE_SPIP"><:accuel:></a>
<BOUCLE_pathway(HIERARCHIE) {id_rubrique}>
<a href="#URL_RUBRIQUE">[(#TITRE|supprimer_numero)]</a>
</BOUCLE_pathway>
<a href="#URL_RUBRIQUE">[(#TITRE|supprimer_numero)]</a>
</div>

If our root sections are lingual versions of the site, quite often we do not need to display it on tha path, then request must be changed by following (in fact we just add LIMIT 1,100):

<div class="pathway">
<a href="#URL_SITE_SPIP"><:accuel:></a>
<BOUCLE_pathway(HIERARCHIE) {id_rubrique} {1,100}>
<a href="#URL_RUBRIQUE">[(#TITRE|supprimer_numero)]</a>
</BOUCLE_pathway>
<a href="#URL_RUBRIQUE">[(#TITRE|supprimer_numero)]</a>
</div>

Displaying of info from two sections at the same time

Quite often we need to display the last articles from two sections & inner subsection with the sorting according to date. Variant according which we display firstly from one section, then from another is not valid. Thus we use array & receive next coed:

#SET{rubs, #ARRAY}
<BOUCLE_list (RUBRIQUES) {id_parent IN 4,8}>
#SET{rubs, #GET{rubs}|push{#ID_RUBRIQUE}}
</BOUCLE_list>

<ul>
<BOUCLE_last (ARTICLES) {id_rubrique IN #GET{rubs}} {par date} {inverse} {0,5}>
<li><a href="#URL_ARTICLE" title="#TITRE">#TITRE</a></li>
</BOUCLE_last>
</ul>

Displaying of the table (by rows)

Displaying elements by 3 items in a row.

<table>
<B_row>
<tr>
<BOUCLE_row (ARTICLES) {id_rubrique=5} {doublons} {par date} {0,3}>
<td  background="IMG/[(#LOGO_ARTICLE|fichier)]" >
<a href="#URL_ARTICLE">#TITRE</a>
</td>
</BOUCLE_row>
</tr>
<BOUCLE_row_again (BOUCLE_row)></BOUCLE_row_again>
</B_row>
</table>

Defining of certain class to the link on current section

It is used during color allocation of current link at menu.

class="[(#ID_RUBRIQUE|=={#_main:ID_RUBRIQUE}|?{on,''})]"

Displaying of insertion every 3 block iteration

[(#COMPTEUR_BOUCLE|modulo{3}|=={0}|?{'<div class="clear"></div>'})]

Displaying of element according to the current language

In this case section 1133 language is arabic & we check if current language matches with arabic - we display one result, of not - another.

<BOUCLE_arlang (RUBRIQUES) {id_rubrique=1133} {lang=#LANG} {0,1}>
        <link rel="stylesheet" type="text/css" href="elements/voltaire-#LANG.css" media="screen,print">
</BOUCLE_arlang>
</B_arlang>       
        <link rel="stylesheet" type="text/css" href="elements/voltaire.css" media="screen,print">
<//B_arlang>

Connection keyword-article-section

we need to display titles of keywords from section 1. For every keyword it is necessary to display section list, in which there are article containing this keyword. Section list must be sorted.

<BOUCLE_manufacturer_mot(MOTS) {id_groupe=1} {par id_mot}>
<div class="right_title"><span>#TITRE</span></div>
<ul>
[(#REM) WE alredy defined, which article with keyword "решение для..."]
[(#REM) for this article we pick up unique id_rubrique {fusion id_rubrique}]
[(#REM) Saved them into array just for defining list of displaying.]

#SET{rubs, #ARRAY}
<BOUCLE_art_mot(ARTICLES) {id_mot} {id_secteur=3} {fusion id_rubrique}>
#SET{rubs, #GET{rubs}|push{#ID_RUBRIQUE}}
</BOUCLE_art_mot>
[(#REM) Displayed from massive]       
<BOUCLE_rub_mot(RUBRIQUES) {id_rubrique IN #GET{rubs}} {par num titre}>
<li><a href="#URL_RUBRIQUE">[(#TITRE|supprimer_numero)]</a></li>
</BOUCLE_rub_mot>
</ul>
</BOUCLE_manufacturer_mot>

How to diplay articles at which field #TEXTE is not empty

Using criteria in request {!texte LIKE ''}

to top