Keyword

How can i display the category image using mod_k2_tools module?

  • pamidipadudravid
  • pamidipadudravid's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 10 months ago #98794 by pamidipadudravid
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
13 years 10 months ago #98795 by Magda Chornacka
I need the same but in mod_k2_content.

 

Anyone, please?

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

More
13 years 10 months ago #98796 by Magda Chornacka
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
13 years 10 months ago - 5 years 10 months ago #98797 by william white
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: 5 years 10 months ago by JoomlaWorks.

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

  • pamidipadudravid
  • pamidipadudravid's Avatar Topic Author
  • Offline
  • Junior Member
More
13 years 10 months ago #98798 by pamidipadudravid
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
13 years 10 months ago #98799 by Magda Chornacka
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.


Powered by Kunena Forum