Thursday, September 8, 2011

Generate correct SEF urls in joomla

I was constructing links like below in JmailAlerts plugins to generate SEF urls
$link=JRoute::_(JURI::root().'index.php?option=com_eventlist&view=details&id='.$row->id);
But it was not generating SEF urls at all.
I found this solution for generating SEF urls on joomla forum.
$link=JURI::root().substr(JRoute::_('index.php?option=com_eventlist&view=details&id='.$row->id),strlen(JURI::base(true))+1);
This generates absoulte SEF urls you need as per SEO settings in Global Configuration. 
Related Posts Plugin for WordPress, Blogger...