Keyword

Creating Categeory URL in Custom Module

More
6 years 5 months ago #165237 by Aram
Hi,
I'm creating a custom module to retrieve some categories. I can retrieve it all from database (id, name, alias, etc..).
The questions are:
1. How can I create a (SEF)link to these categories?
2. If there is already a menu item for category, using that URL for the category.

Thx in advance,
Aram

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 5 months ago #165243 by Krikor Boghossian
Replied by Krikor Boghossian on topic Creating Categeory URL in Custom Module
Hello Aram,

I would urge to look at the K2 Tools module which offers this functionality.
Its helper will assist you.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
6 years 5 months ago #165247 by Aram
Replied by Aram on topic Creating Categeory URL in Custom Module
Hi Krikor,
You pointed me in the right direction. I think I found it.
First including the route.php:
require_once(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');

Using this line:
<a href="'.urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($row->id.':'.urlencode($row->alias)))).'">'.$row->name.'</a>
and replacing $row->id, $row->alias and $row->name with my own retrieved variables did it.

So, thank you again!
Aram

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
6 years 5 months ago #165255 by Krikor Boghossian
Replied by Krikor Boghossian on topic Creating Categeory URL in Custom Module
You 're welcome Aram :)
If DS returns a notice you can swap it with a slash.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum