Keyword

SOLVED - Category Image in Item View

  • Magda Chornacka
  • Magda Chornacka's Avatar Topic Author
  • Offline
  • New Member
More
13 years 2 months ago #98630 by Magda Chornacka
SOLVED - Category Image in Item View was created by Magda Chornacka
Hi guys.

 

I'd like to put in articles / items small image of category that article/item belongs to.

I tried apply code from category.php into item.php but it doesn't get the image .

 

<img alt="<?php echo $this->category->name; ?>" src="<?php echo $this->category->image; ?>" style="width:<?php echo $this->params->get('catImageWidth'); ?>px; height:auto;" />

 

 

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

  • Magda Chornacka
  • Magda Chornacka's Avatar Topic Author
  • Offline
  • New Member
More
13 years 2 months ago #98631 by Magda Chornacka
Replied by Magda Chornacka on topic SOLVED - Category Image in Item View
Ok, solution was quite simple ;) First I tried to use DB query but obviously I'm not familiar with SQL.

So this is how it looks now - it's vewy easy and simple:

 

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

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

More
13 years 2 months ago #98632 by william white
Replied by william white on topic SOLVED - Category Image in Item View
Nice, i was trying to do the same thing except mixing the JPATH_ROOT command and couldnt hold my .'s and ..DS.'s right

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

  • gerardo
  • gerardo's Avatar
  • Visitor
13 years 2 months ago #98633 by gerardo
Replied by gerardo on topic SOLVED - Category Image in Item View
Thanks for sharing!

 

Would you know how to make the opposite? Show as category image the latest item image of that category?

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


Powered by Kunena Forum