1
我已经在我的网站上安装了一个脚本来显示简单的新闻文章。在后端有一个包含所有的数据库的一个.csv外商投资企业 - 和前端包括该代码的(虽然我已经改变了它,以适应自己的网站):将PHP输出分割成多个页面
<?php
//get news class and array
include_once('newsadmin/includes/newsTools.class.inc.php');
$newsTools = new newsTools('csv/news.csv');
$news_headlines = $newsTools->getNewsArray();
//output news array as formatted html
if (!count($news_headlines)>0){
echo '<p>There are currently no news headlines.</p>';
}else{
foreach ($news_headlines as $key => $item){
list($news_id,$news_date,$news_title,$news_body) = $item;
$formatted_date = date('F j, Y, g:i a',$news_date);
echo <<<HTML
<a name="$news_id" id="$news_id"></a>
<h3>$news_title</h3>
$news_body
<p><em>Posted: $formatted_date</em></p>
<hr />
HTML;
}
}
?>
我试图找到一个解决方案将新闻结果分成多页 - 每页最多10条新闻。这显然在页面这样的底部创建一组链接为< 2 3>
我道歉,如果这是一个很大要求 - 但我搜罗谷歌已经和只拿出解决方案处理使用MYSQL的网站的问题,而我不是。
http://dev.pixxl.us/bwc/news.php
三江源。
你需要设置一些变量来等你试过的限制? – putvande