我们做单页时一般采用自定义页面来做,而调用出自定义页面导航可以用标签SQL调用。如下:
例子1:调用自定义页面分类ID=1的页面导航
[e:loop={'select id,path,title from [!db.pre!]enewspage where classid=1 order by id',20,24,0}]
<?php
$pageurl=$public_r['newsurl'].str_replace('../../','',$bqr['path']);
?>
<li><a href="<?=$pageurl?>"><?=$bqr[title]?></a></li>
[/e:loop]
例子2:调用自定义页面导航并识别当前自定义页面
[e:loop={'select id,path,title from [!db.pre!]enewspage where classid=1 order by id',20,24,0}]
<?php
$pageurl=$public_r['newsurl'].str_replace('../../','',$bqr['path']);
$css='pagecss';
if($classid=='page'.$bqr[id])
{
$css='selfpagecss';
}
?>
<li class="<?=$css?>"><a href="<?=$pageurl?>"><?=$bqr[title]?></a></li>
[/e:loop]
相关说明:
上面例子是调用分类ID=1的自定义页面,不限制可以去掉SQL中“ where classid=1”条件。
例子3:调用自定义页面分类的名称
[e:loop={"select *,b.classname as classname from [!db.pre!]enewspage a left join [!db.pre!]enewspageclass b on a.classid=b.classid",0,24}]
<?echo $bqr[title],'…'.$bqr[classname].'</br>';?>
[/e:loop]
评论(0)