- Posts: 17
COMMUNITY FORUM
K2 php get category
- fabio
-
Topic Author
- Offline
- New Member
Less
More
9 years 2 months ago #151229
by fabio
K2 php get category was created by fabio
Hello to everyone. I'm new in this forum and i know quite well joomla CMS
In a custom site Joomla 3 + K2 i need to get category name and article name in details article by PHP Code (not breadcrumb) so i can output something like
You are here: Category Name -> Article Name
in my item.php
Thank you for help =)
In a custom site Joomla 3 + K2 i need to get category name and article name in details article by PHP Code (not breadcrumb) so i can output something like
You are here: Category Name -> Article Name
in my item.php
Thank you for help =)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 2 months ago #151232
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 php get category
Remember to use overrides instead of editing the core files:
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
You can use this code as a starting point
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
You can use this code as a starting point
You are here: <?php echo $this->item->category->name; ?> -> <?php echo $this->item->title; ?>
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- fabio
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 17
9 years 2 months ago #151261
by fabio
Replied by fabio on topic K2 php get category
Excellent! Exactly what i need. Can make also linkable the category?
Thank you
Thank you
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 2 months ago #151275
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 php get category
Here you go:
You are here: <a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a> -> <?php echo $this->item->title; ?>
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- fabio
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 17
8 years 10 months ago #155006
by fabio
Replied by fabio on topic K2 php get category
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 10 months ago #155009
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic K2 php get category
Hello, the URL is being generated from:
Keep in mind that depending on the context you might need to use $item instead of this $this->item.
<?php echo $this->item->category->link; ?>
Keep in mind that depending on the context you might need to use $item instead of this $this->item.
<?php echo $item->category->link; ?>
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.