Keyword

How to show default Category image for articles without Images

  • Andrew Croce
  • Andrew Croce's Avatar Topic Author
  • Offline
  • New Member
More
13 years 2 months ago #98766 by Andrew Croce
I just started working with K2 for Joomla and so far its working out great.

However I cannot figure out how to get a default category image to show up as the image for articles with no image (within a category-view as well as the item-view). In the options I have "Placeholder image for category if none exists" set to "Show" but this doesn't seem to effect anything. 

The category and the article itself are set to show image.

Any tips would be appreciated.

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

  • Yiota
  • Yiota's Avatar
  • Visitor
13 years 2 months ago #98767 by Yiota
This option doesn't work like that. The placeholder image refers to the category image and not the item images. If you have a list of categories to either show or don't show the placeholder image.

The one you want to do can be done by simply putting an if else statement to the itemImage (item.php file). Now it just checks if the option for the image is set to show and if the image exists to actually show it. You can edit that if statement and add the placeholder image of the item in case the item image is empty.

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

  • Andrew Croce
  • Andrew Croce's Avatar Topic Author
  • Offline
  • New Member
More
13 years 2 months ago #98768 by Andrew Croce
Brilliant, thank you! That did the trick: used $this->item->category->image to get to the default category image.

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


Powered by Kunena Forum