Keyword

Latest News feed, category image

More
13 years 2 months ago #98876 by Mark
Latest News feed, category image was created by Mark
Hi all

My question is an addition to this forum post: community.getk2.org/forum/topics/substitute-for-standard-joomla

 

I'm using this method to display a list of articles in the left col from various categories. I would like to display an image to the left of the title showing which category the article is listed in. EG: If there are articles 3 articles from the category cars, 2 from motorcycles, and 2 from boats, the user can quickly and easily see the articles related to the category they are most interested in simply by looking out for the relevant image.

How can I achieve this?

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

More
13 years 1 month ago #98877 by Mark
Replied by Mark on topic Latest News feed, category image
Is it really not possible to show category image in K2 Content ?

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

More
13 years 1 month ago #98878 by william white
Replied by william white on topic Latest News feed, category image
You will have tooverride mod_k2_content and add something like the following to show the category image

 courtsey of Olivier (jiliko.net)

using this code in your override

<?php

$db = & JFactory::getDBO();
$query = "SELECT * FROM #__k2_categories WHERE id=".$item->categoryid;
$db->setQuery($query);
$category = $db->loadObject(); ?>
You can now have access to all category data, like image, with
$category->image

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


Powered by Kunena Forum