Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

SEF Extension for K2 - Use Item Alias
(1 viewing) (1) Guest
Support forum for users using free JoomSEF extensions. These forums are mainly for mutual help between users.

Please note that due to our capacity limitations, we do not monitor these forums regularly.
  • Page:
  • 1

TOPIC: SEF Extension for K2 - Use Item Alias

SEF Extension for K2 - Use Item Alias 10 years, 1 month ago #19387

Does anyone know how to hack the php in this plugin so that it takes the item alias rather then the item name?

Re: SEF Extension for K2 - Use Item Alias 9 years, 11 months ago #20881

I'm also interested in this issue.

Any help will be appreciated.

Thanks in advance.

Re: SEF Extension for K2 - Use Item Alias 9 years, 11 months ago #20883

I am pretty sure I hacked the php via a post I managed to find on a website. Here's the note I sent to myself at the time:


REPLACE THIS FUNCTION IN THIS FILE:

/components/com_sef/sef_ext/com_k2.php

this now uses item alias AND strips out any dashes that appeared where apostrophes were! For example:

alias I specified was '80's videos'

this got changed to:

www.example.com/80-s-videos

This fix does this:

www.example.com/80s-videos

Here is the code:


function getItemTitle($id){

$database =& JFactory::getDBO();

if(preg_match('!:!', $id)) {

$idExplode = explode(':', $id);

$id = intval($id[0]);

};

$database->setQuery("SELECT `title`, `alias`, `catid` FROM `#__k2_items` WHERE `id` = $id");

$item = $database->loadObject();

$cat = $this->getCategoryTitle($item->catid);

$name = $item->alias;

array_push($cat, $name);

return $cat;

}
Last Edit: 9 years, 11 months ago by benchesters.

Re: SEF Extension for K2 - Use Item Alias 9 years, 11 months ago #20944

Thanks a lot, it works now.

Re: SEF Extension for K2 - Use Item Alias 9 years, 11 months ago #20946

No problem, I was delighted when I found that code after hours of head scratching!
  • Page:
  • 1
User Login Empty