如果网站开启了sef,那么最终页面的路径应该是detail/11.html 这样的路径。我们需要在components/com_showcase目录下增加一个文件 router.php,以下是代码:
<?php
function ShowcaseBuildRoute(&$query)
{
$segments = array();
if(isset($query['view']))
{
$segments[] = $query['view'];
unset($query['view']);
};
if(isset($query['pid']))
{
$segments[] = $query['pid'];
unset($query['pid']);
};
return $segments;
}
function ShowcaseParseRoute($segments)
{
$vars = array();
switch($segments[0])
{
case 'lastest':
$vars['view'] = 'lastest';
break;
case 'detail':
$vars['view'] = 'detail';
$id = explode( ':', $segments[1] );
$vars['pid'] = (int) $id[0];
break;
}
return $vars;
}
?>
这两个函数一个做函数的解析路径,一个做路径合成。
附件中是前台的全部文件。
Attatchments: 您还没有登录,登录后方能下载,如果您还没有注册,请点击 免费注册
相关文章



