Afficher en lien les catégories parentes d'une catégorie

More
12 years 7 months ago - 12 years 7 months ago #18467 by Hableur
Bonjour,

au cas où ça intéresse quelqu'un, pour afficher les titres cliquables des catégories parentes d'une catégorie.

Code à insérer dans category.php du template Flexi
Code:
<div id="categories_parentes"> <?php // ouverture de la base $db = &JFactory::getDBO(); $id_parent = $this->category->parent_id; // si $id_parent = 0, il n'y a pas d'ancêtre while ($id_parent > 0) { // lecture titre, alias et parent_id $query = "SELECT title, alias, parent_id FROM #__categories WHERE id='" . $id_parent . "' "; $db->setQuery($query); $result = $db->loadObjectList(); // construction du lien vers la catégorie parente $lien = '[url=' . JRoute::_(FlexicontentHelperRoute::getCategoryRoute($id_parent . ':' . $result[0]->alias)) . ']'. $result[0]->title . '[/url]'; echo $lien ; $id_parent = $result[0]->parent_id; if ($id_parent>0) echo ' | '; } ?> </div>

Voili, on sait jamais...
Last edit: 12 years 7 months ago by Hableur.

Please Log in or Create an account to join the conversation.

More
12 years 7 months ago #18470 by micker
Merci pour le partage !

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
11 years 11 months ago #24277 by bancil
Merci, génial !!!
C'est exactement ce qu'il me fallait.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.258 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline