0
我瀏覽網頁,並通過指令對下面的鏈接準備我的組件com_listing路由器文件如何處理路由器文件任務和變量的Joomla
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作爲說一個任務「掛牌」和變量「類型」的網址是
index.php/component/listing/entertainment/listing/11
,但它不是actuly要在任務listing.It只是顯示視圖entertainment.I認爲解析路由功能不正常調用,但我沒有到達正確的solution.Please幫助