Use category image inside item view

More
11 years 5 months ago #36725 by mcmurdok
Hello,
how can I use the category image in the item-view?
If no specific item image is assigned to the item I'd like to show the category image instead of the item-image.

Greetings

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

More
11 years 5 months ago #36729 by ggppdk
1. Duplicate a template
2. Edit item.php of your template
if your item.php is a single line then you need to copy-paste some code (just follow the instructions inside item.php)
3. Use some code like this:
Code:
<?php $cid = (int)JRequest::getVar('cid'); $cid = $cid ? $cid : $this->item->catid; $category = JCategories::getInstance('Content')->get($cid); if ($category->getParams()->get('image')):?> <img src="<?php echo $category->getParams()->get('image'); ?>"/> <?php endif; ?>

NOTE: place the above code in an appropriate PHP IF statement to output it only if needed (look to find) when your item image is output


-- 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 5 months ago #36733 by mcmurdok
Thank you,
this was exactly what I needed. ;)

Greetings

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

More
11 years 5 months ago #36737 by micker
think to post a review on jed ;)

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
10 years 1 week ago #50494 by danio_d
I'm sorry to dig up an old post. I need the same change, but in the module.
To view recently added articles, I have to add the name of the category and the photo of this category.
The name I have resolved, but the photo does not come out.

I ask for the support :)

thx
dd

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

More
10 years 1 week ago #50495 by ggppdk
Hello

please note, this is for categoty image via parameter, and not image placed inside the description

also for module, did you try using the FLEXIcontent universal content module?

it can
- show recently added articles together with custom fields
- performance wise for large web-sites
- it can show category information too


-- 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.

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