Excluding items with a particular keyword.

This loop enables your site to avoid displaying some items (section, article, news, ...) if they have been marked with a specific keyword.

This loop follows on from the one explained here: Displaying items with a specific keyword

<BOUCLE_exclude (ARTICLES) {titre_mot=excluded} {doublons}>

<BOUCLE_display_non_excluded (ARTICLES) {tout} {doublons} >
<a href="#URL_ARTICLE">#TITRE</a>

How does it work ?

-  In this loop, all the job is handled by the criteria doublons. The first loop (BOUCLE_exclude) selects from among all the ARTICLES those which are tagged with keyword “excluded” (titre_mot=excluded

-  The second loop (BOUCLE_display_non_excluded) displays all (tout) ARTICLES, except those which have already been selected by the previous loop, also coded with a (doublons) criteria.

-  One can easily replace ARTICLES with RUBRIQUES, BREVES or SITES depending on which items are requested. When so doing, just adapt the content of “href” destination (#URL_RUBRIQUE, #URL_BREVE et #URL_SITE).

-  The keyword used in this example is ’excluded’. You can easily replace it by another one you choose. Make sure not to have 2 or more keywords with the same name (’titre’) in 2 or more different keyword groups, unless of course you are intending to exclude them all.

Originally posted by Olivier GENDRIN. Translated from French by Etienne B. ( loiseau2nuit [AT] no-log.org )

updated on 22 January 2007


Aucune discussion

Ajouter un commentaire

Who are you?
[Log in]

To show your avatar with your message, register it first on gravatar.com (free et painless) and don’t forget to indicate your Email addresse here.

Enter your comment here

This form accepts SPIP shortcuts {{bold}} {italic} -*list [text->url] <quote> <code> and HTML code <q> <del> <ins>. To create paragraphs, just leave empty lines.

Add a document

Follow the comments: RSS 2.0 | Atom