Question

let´s say I have following id´s from articles (#__content)

3,4,5 and I want to know the SEO URLs for these ID´s within my template.

pseudo code:

  $db = JFactory::getDbo();
  $query = $db->getQuery(true);
  $db->setQuery($query);

 $query
        ->select(array('a.seolink'))
        ->from('#__content AS a')
        ->where("a.id = '3'" );  

Anyone knows a query or function which does the job?

with kind regards,

tony

Was it helpful?

Solution

If you have article slug ("id:alias") and category slug ("catid:catalias"), then you could do

$link = JRoute::_(ContentHelperRoute::getArticleRoute($slug, $catslug));

From #__content you can get id, alias and catid, so you just have to get category alias too (since I think it won't work without it, but you can try)

Offtopic: anyone interested in adding tag synonyms for Joomla, please give your opinion

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top