静态页面增加小说邻居

articleinfo.php文件加载模板文件前,加入下面代码 [code]//增加章节列表开始 $bookid = $_GET['id']; $sql3 = mysql_query("SELECT * FROM `jieqi_article_chapter` WHERE `articleid` = $bookid order by `chapterid` asc"); while($list = mysql_fetch_array($sql3,1)){ $listdd[] = $list; } $jieqiTpl->assign( "indexrows", $listdd ); $sql2 = mysql_query("SELECT * FROM `jieqi_article_article` WHERE `articleid` > $bookid-6 and `articleid` < $bookid+6 order by `articleid` asc"); while($list2 = mysql_fetch_array($sql2,1)){ $listdd2[] = $list2; } $jieqiTpl->assign( "indexrows2", $listdd2 ); $file_path = dirname(__FILE__).'/../../files/article/html'.subdirectory($bookid).'/'.$bookid.'/linju.html'; $filetime = @filemtime("$file_path"); if(!file_exists($file_path)||time()-$filetime>86400){ $sqls = mysql_query("SELECT * FROM `jieqi_article_article` WHERE `articleid` > $bookid-6 and `articleid` < $bookid+6 order by `articleid` asc"); while($lists = mysql_fetch_array($sqls,1)){ $file_content .= ''.$lists.''; } if(!function_exists("file_put_contents")) { yacms_file_put_contents("$file_path",$file_content); }else{ file_put_contents("$file_path",$file_content); } } function yacms_file_put_contents($filename,$text) { $fp = fopen($filename,"w"); fwrite($fp,$text); fclose($fp); }[/code]在需要调用的地方加
已邀请:

要回复问题请先登录注册