I have a multilingual website running SPIP. The highest level sections consists of all the languages. Under the language is the 'real' hierarchy as the end user experiences it. On the first level here, I have four sections, each identified by its own colour, so that I can create an effect like on bbc.com: every section (e.g. sports) has its own colour.

Now, in the sidebar, I want to create a list of latest updates, site-wide. This is not the problem, I'll put the code below. But now I need to identify the number of the highest level section, ignoring the language level (so I cannot use #ID_SECTEUR). Would something like this be possible?

The code for the latest updates loop:

<BOUCLE_recent(ARTICLES){id_secteur}{age<150}{par date}{inverse}{!lang_select}{!mots.titre = 'NotInMenu'}{0,0}>
    <div class="recent_article">
        <h3><a href="#URL_ARTICLE">[(#SOUSTITRE): ][(#TITRE)]</a></h3>
        <p class="artdate">[(#DATE|affdate_jourcourt)]</p>
        <p class="artdescr">[(#INTRODUCTION|couper{320})]</p>
    </div>
</BOUCLE_recent>
有帮助吗?

解决方案

The answer can be found using the HIERARCHIE loop:

<BOUCLE_highest_rubrique(HIERARCHIE){id_article}>
    [(#COMPTEUR_BOUCLE|=={2}|?{#ID_RUBRIQUE,''})]
</BOUCLE_highest_rubrique>

其他提示

To assign a different colors to the rubriques you could use the #COMPTEUR_BOUCLE tag inside the loop.

<BOUCLE_rubriques(RUBRIQUES) {id_parent=#ID_RUBRIQUE} {par num titre}>
<div class="block#COMPTEUR_BOUCLE">#TITRE</div>
</BOUCLE_rubriques>

This will generate following code:

<div class="block1">#TITRE</div>
<div class="block2">#TITRE</div>
<div class="block3">#TITRE</div>
<div class="block4">#TITRE</div>

You should assign different bg color to each class

To get last update through the website just remove the {id_secteur} from loop. Or describe you situation detailed.

<BOUCLE_recent(ARTICLES) {age<150}{par date}{inverse}{!lang_select}{!mots.titre = 'NotInMenu'}{0,0}>
    <div class="recent_article">
        <h3><a href="#URL_ARTICLE">[(#SOUSTITRE): ][(#TITRE)]</a></h3>
        <p class="artdate">[(#DATE|affdate_jourcourt)]</p>
        <p class="artdescr">[(#INTRODUCTION|couper{320})]</p>
    </div>
</BOUCLE_recent>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top