帝国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> <!--频道页面将[!--classid--]换成[!--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; ?>
你觉得文章内容怎么样