- Posts: 4
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Trying to add category image to all articles based on that
Trying to add category image to all articles based on that
- Chuck Szymaszek
- Topic Author
- Offline
- New Member
Less
More
7 years 2 months ago #164198
by Chuck Szymaszek
Trying to add category image to all articles based on that was created by Chuck Szymaszek
I have searched the K2 forums and I see nothing conclusive on how to do two things..
1. Allow the default category image to flow to the article image for the category it is in and do this in both:
I would like to basically say, if the k article DOES NOT have a image, then use the category image in its place (in both the k2 module AND the k2 component).
Is there anywhere I can get good information on how to do this? I am not a php programmer.. but am adept in programming.. and just need to know the EXACT files that I need to change.. and maybe the line number to which code I need to change
Thanks and frustrated!
1. Allow the default category image to flow to the article image for the category it is in and do this in both:
- a. The k2 module
- b. the k2 component itself
I would like to basically say, if the k article DOES NOT have a image, then use the category image in its place (in both the k2 module AND the k2 component).
Is there anywhere I can get good information on how to do this? I am not a php programmer.. but am adept in programming.. and just need to know the EXACT files that I need to change.. and maybe the line number to which code I need to change
Thanks and frustrated!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 2 months ago #164205
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Trying to add category image to all articles based on that
Hello Chuck,
I can provide guidelines but I cannot provide a solution since this is a task which requires a decent amount of time.
If you are not familiar with Joomla!'s templating then I suggest that you hire a developer.
Depending on the context, the category's image can be retrieved like this:
You need to override the item.php and category_item.php files
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
A similar concept where a placeholder is being used when there is no image:
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L90-L99
I can provide guidelines but I cannot provide a solution since this is a task which requires a decent amount of time.
If you are not familiar with Joomla!'s templating then I suggest that you hire a developer.
Depending on the context, the category's image can be retrieved like this:
$this->item->category->image or,
$item->category->image
You need to override the item.php and category_item.php files
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
A similar concept where a placeholder is being used when there is no image:
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L90-L99
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Chuck Szymaszek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
7 years 2 months ago #164259
by Chuck Szymaszek
Replied by Chuck Szymaszek on topic Trying to add category image to all articles based on that
Hi Krikor,
So if I want to do
A similar concept where a placeholder is being used when there is no image:
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L90-L99
Which php page is this referring to for the line code replacement?
So if I want to do
A similar concept where a placeholder is being used when there is no image:
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L90-L99
Which php page is this referring to for the line code replacement?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 2 months ago #164263
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Trying to add category image to all articles based on that
The item.php and category_item.php.
Remember to use overrides and keep an eye where $item and $this->item is being used.
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
Remember to use overrides and keep an eye where $item and $this->item is being used.
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Trying to add category image to all articles based on that