Keyword

What is the code of the K2 alias?! SOS!!

  • B_Dark
  • B_Dark's Avatar Topic Author
  • Offline
  • Premium Member
More
13 years 8 months ago #92022 by B_Dark
I made this:
***********************************************************************************************************
if ($option == "com_k2")
{
$url = JRoute::_('index.php?option=com_k2&view=item&id='.$Itemid.'item&id='.$row->id);
$title = stripslashes($row->title);
$fields = "[url=".$url."]".$title."[/url]";
}
$success = $message->post ( $catid, $fields, $options );

if ($success) {
$newMessageId = $message->save ();
}
***************************************************************************************************
It gives me this result without the K2 alias title
www.mysite.com/news/technology/item/863.html


What do I have to add to this line so it could give me as a result the alias title, something like this:
www.mysite.com/news/technology/item/863-new-iphone.html

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

  • B_Dark
  • B_Dark's Avatar Topic Author
  • Offline
  • Premium Member
More
13 years 8 months ago #92023 by B_Dark
Replied by B_Dark on topic What is the code of the K2 alias?! SOS!!
help me plz! why k2 community dont have support the last months?!

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

  • B_Dark
  • B_Dark's Avatar Topic Author
  • Offline
  • Premium Member
More
13 years 8 months ago #92024 by B_Dark
Replied by B_Dark on topic What is the code of the K2 alias?! SOS!!
:(

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

More
13 years 8 months ago #92025 by George Vouliakis
Replied by George Vouliakis on topic What is the code of the K2 alias?! SOS!!
Hi B_Dark!

 

Following 2 options I have used in the past (both succesfully):

 

1st Option:

$link = 'index.php?option=com_k2&view=item&id='.$key->id.':'.urlencode( $key->alias ).'&Itemid='.$itemId;$link = urldecode ( $link );

JRoute::_( $link );

 

2nd Option - more complex, using K2 getItemRoute method:

$link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($key->itemid.':'.urlencode($key->itemalias), $key->catid.':'.urlencode($key->catalias))));

 

Here is a part of my query executed before above 

$query= 'SELECT c.id AS catid, c.name AS catname, c.alias AS catalias,                         i.id AS itemid, i.title AS itemtitle, i.introtext AS itemintro, i.catid AS itemcatid, i.alias AS itemalias, i.featured AS feat, i.published AS publ                                        FROM #__k2_categories AS c                LEFT JOIN #__k2_items AS i ON c.id = i.catid.......'

 

Hope that helped you!

 

George

 

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


Powered by Kunena Forum