Keyword

How can i display the category image using mod_k2_tools module?

  • pamidipadudravid
  • pamidipadudravid's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 4 weeks ago #98794 by pamidipadudravid
pamidipadudravid created the topic: How can i display the category image using mod_k2_tools module?
Hai .............

 

i need categoey title and image and  discription in front page  as  a module....

How can i display the category image using  mod_k2_tools module?

i get the image name only which is stored in media/k2/categories/cache/

 

 

$output .= '<a href="'.urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($row->id.'&layout=category'))).'">'.$row->image.'</a><span>'.$row->numOfItems.'</span><br/>'.$row->description.'</div>';

 

 

 

 

am using the above code in my  mod_k2_tools   module of     helper.php

plese  find the image.......

 

got my problem.....

 

 

anyone plz help me?

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

More
8 years 2 weeks ago #98795 by Magda Chornacka
Magda Chornacka replied the topic: How can i display the category image using mod_k2_tools module?
I need the same but in mod_k2_content.

 

Anyone, please?

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

More
8 years 1 week ago #98796 by Magda Chornacka
Magda Chornacka replied the topic: How can i display the category image using mod_k2_tools module?
Is there anyone who could have any clue how to do this? Anyone from the team? Please?

 

My solution for Item View

 

<img alt="<?php echo $this->item->category->name; ?>" src="media/k2/categories/<?php echo $this->item->category->image; ?>" 

 

NOT WORK in mod_k2_content but I need this so bad!

 

Thx.

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

More
8 years 1 week ago - 1 week 1 day ago #98797 by william white
william white replied the topic: How can i display the category image using mod_k2_tools module?
Use this code from Olivier @Jiliko.net
<?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, by putting this in your override code $category->image

To override mod_k2-content first create a directory in your templates html directory called mod_k2_content.

Next create a directory inside the newly created mod_k2_content and call it default.

Copy the file "yoursiteroot/modules/mod_k2_content/tmpl/Default/default.php " into the newly created folder.

Make changes to this default.php to customize mod_k2_content.
Last edit: 1 week 1 day ago by Fotis.

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

  • pamidipadudravid
  • pamidipadudravid's Avatar Topic Author
  • Offline
  • Junior Member
More
8 years 1 week ago #98798 by pamidipadudravid
pamidipadudravid replied the topic: How can i display the category image using mod_k2_tools module?
is this code helpful for get the category image using mod_k2_tools, am using mod_k2_tools module?plz help me.. thanks in advance and  sorry for my poor english

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

More
8 years 1 week ago #98799 by Magda Chornacka
Magda Chornacka replied the topic: How can i display the category image using mod_k2_tools module?
Yes, it's helpfull if you know how to megre $category with $item.

Unfortunately I have no idea how to use it so can't help you. Sorry.

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

Moderators: william white

Powered by Kunena Forum