To show the same article in several different sections without keywords

How to manage the presentation of the same article in different hierarchies of sections without keywords.

The issue

How would it be possible to place the same article in different sections, showing the hierarchy of each section, and the «good» path to the article ?

Simple hierarchy

With SPIP it is possible to manage different subdivisions for articles using keywords (as blogs do). However it is not possible to create tree structures for keywords and, consequently, such a solution is only suitable to a very simple subdivision, without any subcategories or subsections.

How to face it

Diego Weisz, an Italian SPIP user, proposes to manually create the various hierarchical structures of the sections and to insert the same article in most of them using the article redirection feature.

The limits

This kind of management has surely some limits:

-  the impossibility to know in which sections an article is present, and all other ones that redirect to it, in an unique page.

-  it is not possible to use the context of the virtual article, as SPIP will always take as a reference the real article. As an example, it is not possible to use the HIERARCHIE loop to show the navigation path of the virtual article in the page that shows the article itself.

The first point is not easy to solve. After all, we are asking SPIP to do something it is not supposed to do !

A last effort

About the second point, it is possible to use a simple hack.
Every time a user asks for the page of an article for which a redirection exists, SPIP redirects the browser to the specified URL. This last one does not contain any reference to the source virtual article. If it were possible to redirect the browser towards an URL in which the source article id is present too, it would be possible to show the original article and, at the same time, to use the context of the virtual article.

Let’s supose we have 2 articles with id 1 and 2. This last one is a virtual one and must redirect to article 1. It is sufficient to write this URL in the redirect box:

http://mysite.com/article.php3?id_article=1&id_virt=2

The variable id_virt has been introduced and its value is the source article id.

How is it possible to use this information inside the template of our page to show the path of the article whose id is id_virt or that of the article whose id is id_Article if id_virt is not present?

Thanks to the following loop:

<!-- If id_virt exists - it selects the article with id=id_virt-->
<BOUCLE_art(ARTICLES) {id_article=#ENV{id_virt}}>
        <BOUCLE_hier(HIERARCHIE) {id_article}>
        </BOUCLE_hier>
</BOUCLE_art>
        <!-- id_virt does not exist - it selects the article with id=id_article-->
        <BOUCLE_art2(ARTICLES) {id_article}>
                <BOUCLE_hier2(HIERARCHIE) {id_article}> 
                </BOUCLE_hier2>
        </BOUCLE_art2>
<//B_art>

Discussion

Aucune discussion

Rispondere all’articolo

Chi sei?

Per mostrare qui il tuo avatar, registralo prima su gravatar.com (gratis e indolore). Non dimenticare di fornire il tuo indirizzo email.

Inserisci qui il tuo commento

Questo form accetta scorciatoie SPIP [->url] {{gras}} {italique} <quote> <code> et le code HTML <q> <del> <ins>. Per creare i paragrafi, lascia delle linee vuote.

Aggiungi un documento

Suivre les commentaires : RSS 2.0 | Atom

Dernière modification de cette page le 25 gennaio 2007