Question

It is possible to create an IF query for the tag in SPIP? When i have only one article linked to the tag than he take me directly to the article. But if i have more than 1 article, than he does taken me to the tag page of spip, where are the listing of the linked article.

Here the code to go directly to the article

<div id="tagsphere-#ENV{id_article}"> 
    <ul>
        <BOUCLE_mot(MOTS){id_groupe ?}>  
            <B_article>
            <li>
                <a<BOUCLE_article(ARTICLES){id_mot = #ID_MOT}{0, 1}> href="#URL_ARTICLE"</BOUCLE_article>>
                    #TITRE
                </a>
            </li>  
            </B_article>
        </BOUCLE_mot>   
    </ul>
</div>

and here the code to go to the tag menu

<div id="tagsphere-#ENV{id_article}"> 
    <ul>
        <BOUCLE_mot(MOTS){id_groupe ?}>                 
            <li>[<a href="#URL_MOT">(#TITRE)</a>]</li>  
        </BOUCLE_mot>   
    </ul>
</div>

Thanks in advance

Was it helpful?

Solution

Try this, will work with any SPIP version.

    <BOUCLE_mot(MOTS){id_groupe ?}>
[(#REM) Link to mot]  
        <BOUCLE_check(ARTICLES) {id_mot} {1,1}>
            <li><a  href="#_mot:URL_MOT">#_mot:TITRE</a></li>
            [(#ID_ARTICLE|oui)]
        </BOUCLE_check>
[(#REM) Link to one article]
            <BOUCLE_one(ARTICLES) {id_mot} {0,1}>
                <li><a  href="#URL_ARTICLE">#_mot:TITRE</a></li>
            </BOUCLE_one>               
        <//BOUCLE_check>
    </BOUCLE_mot>

OTHER TIPS

Conditional display is a real lack in SPIP. This is what I would do (don't have any SPIP environment with me to check).

<div id="tagsphere-#ENV{id_article}"> 
    <ul>
        <BOUCLE_mot(MOTS){id_groupe ?}>

            <BOUCLE_articles(ARTICLES){id_mot = #ID_MOT}>
                <B_article_unique>
                <li>
                    <a<BOUCLE_article_unique(ARTICLES){id_article}{si #TOTAL_BOUCLE|==1}> href="#URL_ARTICLE"</BOUCLE_article_multiple>>
                        #TITRE
                    </a>
                </li>  
                </B_article_unique>

                <BOUCLE_article_multiple(ARTICLES){id_article}{si #TOTAL_BOUCLE|!=1} />
                <li>
                    <a href="#URL_MOT">
                        #TITRE
                    </a>
                </li>  
                </B_article_muliple>
            </BOUCLE_articles>

        </BOUCLE_mot>   
    </ul>
</div>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top