- Posts: 7
COMMUNITY FORUM
Forcing a default image into an article
- Chris Papa
-
Topic Author
- Offline
- New Member
Less
More
13 years 3 weeks ago #64339
by Chris Papa
Forcing a default image into an article was created by Chris Papa
I want to force my articles, if they are published without an IMAGE, to be published with a default placeholder image. The DEMO of the template with the QuickStart was performing this, but at some point in the dev, it stopped.
Lacking this image is going to be a very big annoyance, and will force some of the modules to look rather foolish.
If anyone has any clue at all how to go about how to do this, I am all ears.
This is an example of what I would like to have posted as a default article if someone is lazy and posts an article without an image.
Lacking this image is going to be a very big annoyance, and will force some of the modules to look rather foolish.
If anyone has any clue at all how to go about how to do this, I am all ears.
This is an example of what I would like to have posted as a default article if someone is lazy and posts an article without an image.
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
Less
More
- Posts: 3722
13 years 3 weeks ago #64340
by william white
Replied by william white on topic Re: Forcing a default image into an article
Although this thread is not "solved" it looks like a good start in the right direction
getk2.org/community/New-to-K2-Ask-here-first!/8950-Default-item-image#8950
getk2.org/community/New-to-K2-Ask-here-first!/8950-Default-item-image#8950
Please Log in or Create an account to join the conversation.
- Chris Papa
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 7
13 years 3 weeks ago #64341
by Chris Papa
Replied by Chris Papa on topic Re: Forcing a default image into an article
OK, I think with a combination of using the link above as a starting point, I have completed the code, and this works on my site, which uses the JA-Orisite template. This template has K2 over-rides on it. I am not sure of that matters, but future readers of this thread may find this information useful.
Below is the exact code from the item.php file my template defaults to.
Below is the exact code from the item.php file my template defaults to.
Log in or Create an account to join the conversation.
- Chris Papa
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 7
13 years 3 weeks ago #64342
by Chris Papa
Replied by Chris Papa on topic Re: Forcing a default image into an article
Here is the code for the Category View ... category_item.php
Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
Less
More
- Posts: 3722
13 years 3 weeks ago #64343
by william white
Replied by william white on topic Re: Forcing a default image into an article
Nice!
Please Log in or Create an account to join the conversation.
- Peter Grube
-
- Offline
- Elite Member
Less
More
- Posts: 241
13 years 3 days ago #64344
by Peter Grube
Replied by Peter Grube on topic Re: Forcing a default image into an article
Thx Chris for sharing, this makes it much easier to control the layout and can still overide by selecting hide in item options, everything worked fine except that in Category view I got a error message (a error has occured) when clicking on the image and it trying to open in modal, but I changed it to link to to item so not a problem & in item view i removed the link & class altogether.
I hope K2 considers make this part of K2 Core the only thing that would make it even better is if we could assign a default image for each category and use that image anyway thx again.
I hope K2 considers make this part of K2 Core the only thing that would make it even better is if we could assign a default image for each category and use that image anyway thx again.
Please Log in or Create an account to join the conversation.
- Емил Калибрадов
-
- Offline
- New Member
12 years 1 month ago #64345
by Емил Калибрадов
Replied by Емил Калибрадов on topic Re: Forcing a default image into an article
Why when try to set default image in "display items by tag" I receive this error:
The code on line 86:
Everywhere else Chirs's code is working fine.
Fatal error: Call to a member function get() on a non-object in /home/novchaso/public_html/mysite.com/components/com_k2/templates/default/tag.php on line 86
The code on line 86:
<?php elseif($this->item->params->get('catItemImage') && empty($this->item->image)): ?>
Everywhere else Chirs's code is working fine.
Please Log in or Create an account to join the conversation.