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:

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}>
        <!-- id_virt does not exist - it selects the article with id=id_article-->
        <BOUCLE_art2(ARTICLES) {id_article}>
                <BOUCLE_hier2(HIERARCHIE) {id_article}> 

updated on 25 January 2007


Aucune discussion

Ajouter un commentaire

Who are you?
[Log in]

To show your avatar with your message, register it first on (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