详情页

帝国cms ajax获取当前栏目最新页面

时间:2024年03月01日

编辑:佚名

帝国cms模板中ajax获取当前栏目最新页面方法
模板页面
<script type="text/javascript" src="http://img.lanrentuku.com/img/js/jquery.js"></script>
<script src="[!--news.url--]e/extend/ajaxnews.php?classid=[!--classid--]" type="text/javascript"></script>
频道页面使用[!--self.classid--]
</head> 
<body>
<div>
<ul id="ajaxnews">
</ul> 
e/extend/ajaxnews.php
<?
require("../class/connect.php");
require("../class/db_sql.php");
$link=db_connect();
$empire=new mysqlquery();
$html="";
$classid = intval($_GET['classid']);
if($classid){
    $classpath = $empire->fetch1("select classpath from {$dbtbpre}enewsclass where classid=".$classid);
    $classpath = $classpath['classpath'];
    $db_sql = "select * from {$dbtbpre}ecms_news where classid = $classid order by newstime desc limit 10";
    $sql=$empire->query($db_sql);
    while($r=$empire->fetch($sql))
    {
        $html.="<li><a href=".$public_r['newsurl'].$classpath."/".$r['newspath']."/".$r['filename'].".html>".$r['title']."</a></li>";
    }
}
?>
$(function(){
    $("#ajaxnews").html("<?=$html?>");
});
<?
db_close();
$empire=null;
?>
相关文章
猜你需要