我已浏览网页并使用以下链接上的说明为我的组件com_listing准备路由器文件
http://forum.joomla.org/viewtopic.php?t=611587
这是我的路由器文件代码
function listingBuildRoute(& $query)
{
$segments = array();
if(isset($query['view']))
{
$segments[] = $query['view'];
unset( $query['view'] );
}
if(isset($query['task']))
{
$segments[] = $query['task'];
unset( $query['task'] );
};
if(isset($query['id']))
{
$segments[] = $query['id'];
unset( $query['id'] );
};
if(isset($query['type']))
{
$segments[] = $query['type'];
unset( $query['type'] );
};
return $segments;
}
function listingParseRoute($segments)
{
$vars = array();
switch($segments[0])
{
case 'accomodation':
$vars['view'] = 'accomodation';
$id = explode( ':', $segments[2] );
$vars['type'] = (int) $id[0];
break;
case 'entertainment':
$vars['view'] = 'entertainment';
$id = explode( ':', $segments[2] );
$vars['type'] = (int) $id[0];
break;
}
switch($segments[1])
{
case 'listing':
$vars['task'] = 'listing';
$vars['task'] =$segments[1];
break;
case 'details':
$vars['task'] = 'details';
$vars['task'] =$segments[1];
break;
}
return $vars;
}
正在准备URL成功,如任务“列表”和变量“类型”URl
index.php/component/listing/entertainment/listing/11
但它并没有真正进入任务列表。它只是显示视图娱乐。我认为解析路由功能没有正确调用但我没有达到正确的解决方案。请帮助