Keyword

Tutorial: Show placeholder image for item

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
12 years 8 months ago #62425 by Nick
So I'm running an anime site with K2 and I have placeholder images saying "coming-soon" when the screenshot has not been uploaded yet. I thought why not share my code for that.

It's actually really easy.

First you need to open up the item.php model which can be found in /components/com_k2/models/item.php

Scroll down to line 118 and you'll see a block of code with a bunch of "if" statements. Select that block (from 118 to 159 (right before it says //extra fields) and delete it.

Replace that with this code found here:
pastebin.com/SzGWTbfX

Now all you need to do is change the "coming-soon" part to whatever you want. The images should be stored in the /images/ folder in the joomla root.

In my case i just have a small version and a large version. I don't need any other sizes. You can obviously change that ;)

Question? Ask!

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

More
11 years 6 months ago #62426 by Felipe Oliveira
Replied by Felipe Oliveira on topic Re: Tutorial: Show placeholder image for item
Thank You so Much....

This post should be fixed, it's an important feature that k2 should add it.

It worked perfectly.

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


Powered by Kunena Forum