【原创】利用帝国CMS循环子栏目标签制作手机版首页
思良:首页竟然可以用循环子栏目标签制作,查看来自,具体还没改成功。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>[!--pagetitle--] </title>
<meta name="viewport" content="width=device-width; initial-scale=1">
<meta name="Keywords" content="">
<meta name="Description" content="">
<link href="skin/skyphonetwo/css/3g.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
<?php
$bclassid=$GLOBALS[navclassid]; //取得本栏目id
//取得本栏目下的子栏目
?>
[e:loop={"select classid, classname, classpath from `[!db.pre!]enewsclass` where bclassid='$bclassid' order by `classid` desc ",7,24,0}]
<?php
//这里是取得该分类下的有图片的最新数据
$commbook=$empire->fetch1("select title,titlepic,smalltext,titleurl,keyboard,groupid,classid,newspath,filename,id from phome_ecms_news where classid = ".$bqr[classid]." and titlepic!='' order by newstime desc limit 1");
$commbookurl=sys_ReturnBqTitleLink($commbook);
?>
<div <?php $i++;if($i%2==0){echo 'id="gl_01"';} ?> >
<ol><h3><?=$bqr[classname]?></h3><a href="<?=$public_r[newsurl].$bqr[classpath]?>">更多>></a></ol>
<div>
<dl>
<dt><a href="<?=$commbookurl?>"><img src="<?=$commbook[titlepic]?>" width="108px" height="85px" /></a></dt>
<dd><b><a href="<?=$commbookurl?>"><?=$commbook[title]?></a></b><a href="#"><?=esub($commbook[smalltext],84)?></a></dd>
</dl>
<ol>
<?php
//取得该分类下的最新数据
$newbook=$empire->query("select title,titlepic,smalltext,titleurl,keyboard,newstime,groupid,classid,newspath,filename,id from phome_ecms_news where classid =".$bqr[classid]." order by newstime desc limit 5");
while($r=$empire->fetch($newbook)) {
?>
<li><a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r[title]?>">·<?=$r[title]?></a><span><?=date('Y-m-d',$r[newstime])?></span></li>
<?php
}
//显示5条
?>
</ol>
</div>
<div></div>
</div>
[/e:loop]
</div>
</body>
</html>
--------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>[!--pagetitle--]</title>
<meta name="viewport" content="width=device-width; initial-scale=1">
<meta name="Keywords" content="">
<meta name="Description" content="">
<link href="skin/skyphonetwo/css/3g.css" rel="stylesheet" type="text/css" />
<script src="skin/skyphonetwo/js/tools.js"></script>
<script src="skin/skyphonetwo/js/swipe.js"></script>
<script>
Y.add('G',{ path : 'skin/skyphonetwo/js/3g.js',charset:'utf-8'})
</script>
</head>
<body>
<div>
<header id="header">
<div>
<a href="index.php">mobile</a>
</div>
<h1 class="title title_home">JYGAWX.com</h1>
<div></div>
</header>
<nav>
<ul>
[e:loop={"select classid,classname from {$dbtbpre}enewsclass where bclassid=0 order by myorder,classid asc",0,24,0}]
<!-- 思良:不想显示那个栏目后面就加and classid!=该栏目ID这个条件,这个灵动只能调用二级导航,如果想用多级的可以用自定义函数[myli]0,1[/myli]使用方法可以参考模版文件夹里的使用说明-->
<?php
$classurl=sys_ReturnBqClassname($bqr,9);//取得栏目地址
if($GLOBALS[navclassid])
{
$fcr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]);
$topbclassid=$fcr[1]?$fcr[1]:$GLOBALS[navclassid];//取得当前栏目的一级栏目ID
if($bqr[classid]==$topbclassid)
{
}
}
?>
<li><a href="<?=$classurl?>"><?=$bqr[classname]?></a></li>
[/e:loop]
</ul>
</nav>
<div>
<div>
[e:loop={0,10,3,1,'firsttitle=2'}]
<div><a href="<?=$bqsr['titleurl']?>"><img src="<?=$bqr['titlepic']?>"></a> </div>
[/e:loop]
</div>
<div>
[e:loop={0,10,3,1,'firsttitle=2'}]
<a href="<?=$bqsr['titleurl']?>"><?=esub($bqr[title],52)?></a>
[/e:loop]
</div>
<div>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
<div id="msg"></div>
<ul>
[e:loop={0,3,13,0,'firsttitle=1'}]
<li><a href="<?=$bqsr['titleurl']?>"><?=esub($bqr[title],45)?></a></li>
[/e:loop]
</ul>
<!-- 子栏目begin -->
[listsonclass]'selfinfo',5,48,0,0,46,0,0[/listsonclass]
<!-- 子栏目end -->
<footer>
<a href="#header"><span></span>返回顶部</a>
<a href="http://www.yoka.com">电脑版</a>
<a href="index.php">手机版</a>
</footer>
</div>
<script>
Y('G',function(){
var titles = document.querySelectorAll('.title_focus a'),
spans = document.querySelectorAll('.select_focus span'),
c = 0,
focus = ScrollImg();
focus = Swipe(document.querySelector('.pic_focus'),{
auto : 5000,
disableScroll: false,
stopPropagation: false,
callback : set
})
function set(n){
titles[c].className = '';
spans[c].className = '';
c = n;
titles[c].className = 'on';
spans[c].className = 'on';
}
})
</script>
</body>
</html>