joomla router replacing first dash or hyphen with a colon
August 29, 2013
No comments
Just came across a strange behavior in Joomla 3 and component routing.
Found out that the first hypen in a SEF URL is always replaced by a colon.
Joomla assumes all SEF URLs have a structure like this: http://yoursefurl/mymenu/1-welcome-to-joomla
The last part is called the slug and this seems to get messed up if you have hyphens in you url and the first part is not an ID.
The Joomla router will translate the slug segment into 1:welcome-to-joomla, replacing the first hypen with a colon to separate the ID.
You either need to adjust your router and include first an id in your url followed by a hyphen or add
$vars['myitem'] = str_replace(“:”, “-” , $segment[1] ) ;
in your router.
Comments
Leave a comment Trackback