[SOLVED] Display only primary category on front-end

More
11 years 9 months ago #33270 by dariofal
Hi!
I have the same problem that was posted in this thread. I've followed the steps but for some reason it didn't work.

I think that maybe it has something to do with the version of the Flexi Content, considering that this solution was posted two years ago and that I upgraded mine to 1.5.6 RC9b r1576. Thus, I didn't find BOF fields portion in category_items.php file. Instead of putting the code there, I've pasted it in the portion related to the position of the template.

Tks in advance, I hope you can help me.

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

More
11 years 9 months ago #33277 by ggppdk
There could be difference with the template
e.g. for blog template in file category_items.php , you should use (inside the item loop):
$items[$i] instead of $item

also put :
Code:
error_reporting(E_ALL); ini_set('display_errors',1);

also while testing, place in top of the file (category_items.php), to print warnings of any not defined variables


-- 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 9 months ago #33603 by dariofal
Hi again!
Sorry for bothering. I've tried your previous solution, but for some reason it didn't work.

I've modified the code taking in account your advice and replacing each $item by $items[$i]:
Code:
<?php foreach ($columns as $name => $label) : ?> <?php foreach($items[$i]->cats as $cat) { if ($cat->id == $items[$i]->catid) { $link = JRoute::_(FlexicontentHelperRoute::getCategoryRoute($cat->slug)); $items[$i]->positions['table']->{'categories'}->display = "<a href='$link'>".$cat->title.""; break; } } ?>

Tks again.

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

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