帝国列表页无限加载方法

第一步骤:

粘贴以下代码放置新建get_news_index.php上并上传到 /e/action:

require('../class/connect.php');

require('../class/db_sql.php');

require('../data/dbcache/class.php');

if($_POST[action] == 'getmorenews'){

$table=htmlspecialchars($_POST[table]);

if(empty($_POST[orderby])){$orderby='newstime';}else{ $orderby=htmlspecialchars($_POST[orderby]);}

if(empty($_POST[myorder])){$myorder='desc';}else{ $myorder='asc';}

if(empty($_POST[limit])){$limit=3;}else{ $limit=(int)$_POST[limit];}

if(empty($_POST[classid])){$where=null;}else{ $where='where classid in('.$_POST[classid].')';}

if(empty($_POST[length])){$length=50;}else{ $length=(int)$_POST[length];}

if(empty($_POST[small_length])){$small_length=120;}else{ $small_length=(int)$_POST[small_length];}

$link=db_connect();

$empire=new mysqlquery();

$num =(int)$_POST['next'] *$limit;

if($table){

$sql=$empire->query("SELECT * FROM `".$dbtbpre."ecms_".$table."` $where order by $orderby $myorder limit $num,$limit");

while($r=$empire->fetch($sql)){

if($r[titlepic]==''){

$r[titlepic]=$public_r[news.url]."e/data/images/notimg.gif";

}

$oldtitle=stripSlashes($r[title]);

$title=sub($oldtitle,'',$length);

$smalltext=stripSlashes($r[smalltext]);

$smalltext=sub($smalltext,'',$small_length);

$classname=$class_r[$r[classid]][classname];

$newsurl=$public_r[newsurl];

$classurl=$newsurl.$class_r[$r[classid]][classpath];

?>

class="cat label label-important"

href="

">

class="label-arrow">

class="text-muted">

发布于

class="focus">

class="thumbnail">

/>

...

阅读()

class="post-comments">评论()

href="JavaScript:makeRequest('e/public/digg?classid=&id=&dotop=1&doajax=1&ajaxarea=diggnum','EchoReturnedText','GET','');"

class="post-like" >赞 (

)

class="post-tags">标签:

href="/337/e/tags/?tagname="

target="_blank" rel="tag"

data-original-title>

//这部分代码是将来列表的样子,可以自己修改自己想要模样

}

}

}

db_close();

$empire=null;

?>

第二步骤:

引入js代码可在自己的服务器下也可以引入远程的。我引的是远程的  

我采用的是栏目新建静态页面方式做的。

[!--pagetitle--]

列表加载这里面

滚动加载更多

你可能感兴趣的:(帝国列表页无限加载方法)