Affichage des contenus par sous-catégories

More
11 years 11 months ago - 11 years 11 months ago #25121 by Medlinya
Bonjour,

J'utilise FlexiContent depuis peu et je suis actuellement en train de créer mes propres templates pour les adapter à mon besoin (templates que je partagerai sur le forum dès que je les aurais finalisés ;) ).

Je cherche à afficher le contenu de mes articles d'une catégorie parente sous forme de blog triés par sous catégorie comme ci-dessous :



Or, aujourd'hui, je n'arrive qu'à afficher mes contenus de la façon suivante :



J'ai ajouté le code suivant dans le fichier category_items.php de mon template :
Code:
function getChilds() { $query = $this->_buildChildsquery(); $this->_childs = $this->_getList($query); // $this->_childs = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); $id = $this->id; $this->_data = null; $k = 0; $count = count($this->_childs); for($i = 0; $i < $count; $i++) { $category =& $this->_childs[$i]; $category->assigneditems = $this->_getassigned( $category->id ); $category->subcats = $this->_getsubs( $category->id ); $this->_id = $category->id; $category->items = $this->getData(); $this->_data = null; $k = 1 - $k; } $this->_id = $id; return $this->_childs; } </script>

Et dans mon fichier category_subcategories.php :
Code:
<?php foreach ($sub->items as $item) : ?> [url=<?php echo JRoute::_( FlexicontentHelperRoute::getItemRoute($item->slug) ); ?>]<?php echo $this->escape($item->title); ?>[/url] <?php endforeach; ?>

J'ai trouvé ces codes sur le forum :
www.flexicontent.org/forum/index.php?f=2...rb_v=viewtopic#p6145

Mais cela ne suffit pas... J'ai toujours le même affichage.
Pour info, bien qu'ayant des notions d'algorithme, je ne connais pas trop le php...

Merci d'avance pour votre aide !

Joomla! 2.5.4
com_flexicontent_v2.0_RC5_r1316
Last edit: 11 years 11 months ago by Medlinya.

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

More
11 years 11 months ago #25124 by ggppdk
mmm,
FAQ template, groups by sub-category, maybe you should duplicate and change FAQ template ?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
11 years 11 months ago #25127 by Medlinya
Ok thanks. I was focalized on blog template instead of watchings FAQ template (the only one I didn't watch..) !!! :?
I try to do, and I will tell if it's okay or not ! ;)

Joomla! 2.5.4
com_flexicontent_v2.0_RC5_r1316

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

More
11 years 11 months ago #25325 by Medlinya
Après avoir tenté de modifier à plusieurs reprises le code du fichier category_items.php issu du template faq (que j'ai bien sûr copié) en y ajoutant par exemple :
Code:
<!-- BOF Ma position --> <?php if (isset($items[$i]->positions['maposition'])) : ?> <div class="maposition"> <?php foreach ($items[$i]->positions['maposition'] as $field) : ?> <span class="element"> <?php if ($field->label) : ?> <span class="label field_<?php echo $field->name; ?>"><?php echo $field->label; ?></span> <?php endif; ?> <span class="value field_<?php echo $field->name; ?>"><?php echo $field->display; ?></span> </span> <?php endforeach; ?> </div> <?php endif; ?> <!-- EOF Ma position -->
code que j'ai utilisé avec le template blog pour afficher le contenu de mes articles.

ou
Code:
<!-- BOF item fields block maposition --> <?php foreach ($columns['maposition'] as $name => $label) : $label_str = ''; if ($item->fields[$name]->parameters->get('display_label', 0)) : $label_str = $label.': '; endif; ?> <li class='maposition'> <?php echo $label_str.( isset($item->positions['maposition']->{$name}->display) ? $item->positions['maposition']->{$name}->display : ''); ?> </li> <?php endforeach; ?> </ul> <!-- EOF item fields block maposition -->
avec ce code j'ai pleins de messages d'erreur (pour chaque positions que j'ai définie) :

Notice: Undefined index: maposition in C:\wamp\www\monsite\components\com_flexicontent\templates\faq-1\category_items.php on line 293

Warning: Invalid argument supplied for foreach() in C:\wamp\www\monsite\components\com_flexicontent\templates\faq-1\category_items.php on line 293

--> ligne 293 qui correspond à
Code:
foreach ($columns['maposition'] as $name => $label) :


Je ne parviens toujours pas au résultat espéré, c'est à dire :

Ma sous-catégorie 1
contenu de mon article 1.1 (avec tous les champs paramétrés dans les positions définies)
contenu de mon article 1.2 (avec tous les champs paramétrés dans les positions définies)

Ma sous-catégorie 2
contenu de mon article 2.1 (avec tous les champs paramétrés dans les positions définies)
contenu de mon article 2.2 (avec tous les champs paramétrés dans les positions définies)
contenu de mon article 2.3 (avec tous les champs paramétrés dans les positions définies)

(Voir aussi l'image ci-dessus)

La template faq me permet seulement d'afficher le titre de mes articles/contenus par sous catégorie.

Ne connaissant pas très bien le php, je galère un peu beaucoup pour trouver le bon code à mettre dans le fichier category_items.php du template faq.
Je pensait pouvoir y arriver toute seule comme une grande... mais je ne dois pas encore être assez grande...

Please Help me !

Joomla! 2.5.4
com_flexicontent_v2.0_RC5_r1316

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

More
11 years 11 months ago #25331 by ggppdk
Maybe avoid changing the code of FAQ template, unless you are an experienced programmer.

You said, that category layout of FAQ template only displays title ???

No, it can display any field,
go to backend edit the template , and add extra fields.


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
11 years 11 months ago #25356 by Medlinya
I already test to add extra fields in the faq template bu it doesn't display like I want.


If I put my extra fields in "aftertitle" position, my fields aren't diplayed next to my image field. I want the field title is written with a special font, but not the others fields. I want my field "Price" is written in italic and my field "availibility" is written in red.
That's why I would like to create my own template in order to customize the display of positions in the category.css file...

Moreover, when I use the faq template, all my items are displayed (merchandise is my main category), then under, the items are displayed again by subcategories... and there is an horizontal scrollbar.






What I would like :


That's why, I'm sure I have to create my own template, but if nobody can help me, I'll do alone, and when I will finish, I'll share my template in this forum for other people like me... Just instead of making 5 hours to make it with help, I will do in 15 hours, if it's not more ! I'm obsinate, I think I can do it !

Apart from this, FlexiContent is a really great extensions !

Joomla! 2.5.4
com_flexicontent_v2.0_RC5_r1316

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.700 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