Can someone please tell me how to add a segment to the beginning of the SEF URL - i.e:
http://somedomain.com/*SEGMENT*/task/id
The *SEGMENT* is just a static string, just for show and is not taken from the query.
I've got a very basic router.php in my component:
function MyComponentBuildRoute(&$query)
{
$segments = array();
if (isset($query['task'])) {
$segments[] = $query['task'];
unset($query['task']);
}
if (isset($query['id'])) {
$segments[] = $query['id'];
unset($query['id']);
}
return $segments;
}
function MyComponentParseRoute($segments)
{
$vars = array();
$count = count($segments);
if ($count) {
$count--;
$segment = array_shift($segments);
if (is_numeric($segment)) {
$vars['id'] = $segment;
} else {
$vars['task'] = $segment;
}
}
if ($count) {
$count--;
$segment = array_shift($segments) ;
if (is_numeric($segment)) {
$vars['id'] = $segment;
}
}
return $vars;
}
Hope someone can help!