I am creating my own component. Is it possible to transform:
Route::_('index.php?option=com_toto&view=tutu')
into /somealiasinmenu
?
(This alias can be found in a menu in the backoffice.)
I can do this:
- link 1 /listAlias
- link 2 /formAlias
When I click on listAlias, I can edit one row. With my router I have this url:
/listAlias/formviewname/123
but I'd like this url /formAlias/123
How can I do that?
Here is my router.php:
function TotoBuildRoute(&$query)
{
$segments = array();
if(isset($query['view'])){
$segments[] = $query['view'];
unset($query['view']);
};
if(isset($query['id'])){
$segments[] = $query['id'];
unset($query['id']);
};
return $segments;
}
function TotoPlaceParseRoute($segments)
{
$vars = array();
if ($segments[0] === 'formviewname') {
$vars['id'] = (int)strstr(end($segments), ':', true);
}
$vars['view'] = $segments[0];
return $vars;
}