- Posts: 33
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- How can i display the category image using mod_k2_tools module?
How can i display the category image using mod_k2_tools module?
- pamidipadudravid
- Topic Author
- Offline
- Junior Member
Less
More
13 years 4 months ago #98794
by pamidipadudravid
How can i display the category image using mod_k2_tools module? was created 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?
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.
- Magda Chornacka
- Offline
- New Member
Less
More
- Posts: 7
13 years 3 months ago #98795
by Magda Chornacka
Replied by Magda Chornacka on topic How can i display the category image using mod_k2_tools module?
I need the same but in mod_k2_content.
Anyone, please?
Anyone, please?
Please Log in or Create an account to join the conversation.
- Magda Chornacka
- Offline
- New Member
Less
More
- Posts: 7
13 years 3 months ago #98796
by Magda Chornacka
Replied by Magda Chornacka on 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.
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.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
13 years 3 months ago - 5 years 3 months ago #98797
by william white
Replied by william white on topic How can i display the category image using mod_k2_tools module?
Use this code from Olivier @Jiliko.net
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.
<?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 3 months ago by JoomlaWorks.
Please Log in or Create an account to join the conversation.
- pamidipadudravid
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 33
13 years 3 months ago #98798
by pamidipadudravid
Replied by pamidipadudravid on 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.
- Magda Chornacka
- Offline
- New Member
Less
More
- Posts: 7
13 years 3 months ago #98799
by Magda Chornacka
Replied by Magda Chornacka on 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.
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.
- Forum
- K2 Community Forum
- English K2 Community
- How can i display the category image using mod_k2_tools module?