Menu Content

Podpora

> Diskusní fóra, FAQs & placená podpora
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 15 years, 8 months ago #19387

  • benchesters
  • OFFLINE
  • Posts: 5
Does anyone know how to hack the php in this plugin so that it takes the item alias rather then the item name?
The topic has been locked.

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

  • Trimud
  • OFFLINE
  • Posts: 2
I'm also interested in this issue.

Any help will be appreciated.

Thanks in advance.
The topic has been locked.

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

  • benchesters
  • OFFLINE
  • Posts: 5
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: 15 years, 5 months ago by benchesters.
The topic has been locked.

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

  • Trimud
  • OFFLINE
  • Posts: 2
Thanks a lot, it works now.
The topic has been locked.

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

  • benchesters
  • OFFLINE
  • Posts: 5
No problem, I was delighted when I found that code after hours of head scratching!
The topic has been locked.
  • Page:
  • 1
Přihlášení uživatele Prázdný