- Posts: 214
COMMUNITY FORUM
make a k2 item url to sef url
- George Nasis
-
Topic Author
- Offline
- Elite Member
i want to achive somthing but don`t know how.
i make a query in which i take the k2 item url but in this format:
www.example.com/categoryA/categoryB/test where it ibelongs
but disabling sef i see that the item`s url is
/index.php?option=com_k2&view=item&id=63:autocad-2014&Itemid=334
so i am wondering maybe i miss something..i see after the item a Itemid is added and it takes =344bu
maybe it is the category?but 334 is surely not the category`s id..
thank you
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
in which table is that???i am asking in order to change my query and add the itemID. and is it possible to achieve that?i mean how gonna combine the k2 item i retrieve to point the specific itemID of joomla menu?
thank you!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
The xx_menu contains the menu item's ID and the element that it is pointing to.
What are you trying to build ?
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
thanks for your interest!
i have this query
www.example.com/component/k2/item/testitem
so i want to change the href to the right one with the menuitem that you already said. i just found that on the table xxxx_menu. so i need to change my query to retrieve also the menuid?
Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Without this, you will not get the proper modules in your view.
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
it is not about modules but about items. how will i get the right Itemid of the relevant k2 item?
for example in the k2 items table the k2 item id is 270 what i retrieve with the query.
in the menu table the itemid is 480. HOW am i supposed to make the query to retrieve the right item?which points to the right k2 item?
thank you
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
In order to get the correct route for an item you need to call the K2 route helper:
<?php
require_once JPATH_SITE.'/components/com_k2/helpers/route.php';
$item->link = K2HelperRoute::getItemRoute($item->id.':'.$item->alias, $item->catid);
?>
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
thank you for your response.
so with this one i imagine that my query will concern only k2 items table and no need for the menu table.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
thank you very much again
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
i thaught the issue will be solved but i was a bit unlucky..the field where i am writing the proper code does not support yet (as they said from joomlapolis) does not support php.. :/
is there another way to achieve the result only with html???
thank you very much
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.