不是吧,一条放一个文本文件里??
把所有的都放在一个文件里吧。。
用file将其取出,按照一定的数目进行分页。
我家里倒是有一个,留下邮箱晚上发给你。

解决方案 »

  1.   

    好kingerq(多菜鸟) ,谢[email protected]
      

  2.   

    <?php
    /**
    *the class show the page
    *fileName : page.php
    *author   : trace @ 2004-2-13
    *email    :  [email protected]
    */
    class Page
    {
    var $filePath;            //存放数据文件的目录
    var $fileName;            //数据文件名
    var $totalNum;            //总的数据数,也是总的行数
    var $totalPage;           //总的页数
    var $result = array();    //存放数据的数组 //构造函数,并取得所有数据
    function Page($fPath,$fName,$pageSize)
    {
    $this->filePath = $fPath;
    $this->fileName = $fName;
    if (!file_exists("./".$this->filePath."/".$this->fileName))
    {
    echo "the data file is not exists!!!";
    exit;
    }
    else
    {
    $this->result  = @file("./".$this->filePath."/".$this->fileName);
    $this->totalNum = count($this->result);
    $this->totalPage = ceil($this->totalNum/$pageSize);
    }
    }
        
    //------------------------------
    //对一些关于页面数据提取的定义
    //------------------------------    //判断是否有下一页
    function isNext($nowPage)
    {
    if ($nowPage < $this->totalPage)
    {
                return true;
    }
    else
    {
    return false;
    }
    }
        
    //判断是否有上一页
    function isPre($nowPage)
    {
    if ($nowPage > 1)
    {
    return true;
    }
    else
    {
    return false;
    }
    } //判断是否正确的页,并返回正确的页数
    function ckPage($nowPage)
    {
    $rPage = ($nowPage < 1) ? 1 : $nowPage;
    $rPage = ($rPage > $this->totalPage) ? $this->totalPage : $rPage;
    return $rPage;
    }
    }
    ?>
      

  3.   

    <?php
    /**
    *fileName  : index.php
    *author    : trace @ 2004-2-13
    *email     : [email protected]
    */
    include("./config.php");
    include("./classes/template.php");
    include("./language/$siteLanguage.php");
    include("./classes/function.php");
    include("./classes/page.php");
    include("./classes/data.php");
    include("./classes/reply.php");
    include("./classes/admin.php");
    $myAdmin = new Admin();//写头部信息
    include("./head.php");//------------------------------------------------------------------
    //一些分页信息,注意$star在下面提取文件数据时要用
    $pageNum     = (isset($_GET[page])) ? $_GET[page] : 1;
    $thisPage    = new Page($dataPath, $dataFile, $pageSize);
    $nowPage     = $thisPage->ckPage($pageNum);                          //取得当前页数
    $star        = ($nowPage-1) * $pageSize;                             //取得起始数据数
    //------------------------------------------------------------------//-----------------------------------------------------------------
    //读取数据文件,并进行当前页面的查询
    $thisData    = new Data($dataPath,$dataFile,$fieldFilter);
    $thisResult  = $thisData->selectSome($star,$pageSize);              //提取从第$star条数据开始的后$pageSize条数据
    //-----------------------------------------------------------------/**
    *中间的模板文件
    *write the main template
    *///------------------------------------------------------------------
    //循环显示留言内容
    $tp         = new Template("./template/$siteTemplate","index.php");
    $myReply    = new Reply($replyPath);
    for ($i=0; $i<(count($thisResult)); $i++)
    {
    $temp[$i] = explode($fieldFilter,$thisResult[$i]);
        $topicList['showTopicID']   = $temp[$i][0];
    $topicList['showImg']       = $temp[$i][1];
    $topicList['showName']      = $temp[$i][2];
    $topicList['showEmail']     = $temp[$i][3];
    $topicList['showOICQ']      = $temp[$i][4];
    $topicList['showPage']      = $temp[$i][5];
    $topicList['showTitle']     = $temp[$i][6];
    $topicList['showContent']   = $temp[$i][7];
    $topicList['showDate']      = $temp[$i][8];
    $topicList['emailToMe']     = $lang['general']['emailToMe'];
    $topicList['replyTopic']    = $lang['guest']['replyTopic'];
    $topicList['replyContent']  = $myReply->getContent($temp[$i][0]);
    if ($myAdmin->ckLogin($_COOKIE[superName],$_COOKIE[superPasswd]))
    {
    $topicList['delete']        = $lang['general']['delete'];
    $topicList['reply']         = $lang['general']['reply'];
    }
    else
    {
    $topicList['delete']      = '';
    $topicList['reply']    = '';
    } $tp->assign("topicList",$topicList);
    }
    //------------------------------------------------------------------
    //------------------------------------------------------------------
    //显示分页信息
    if($thisPage->isNext($nowPage))
    {
    $nPage = ($nowPage + 1);
    $showNext = "<a href=$_SERVER[PHP_SELF]?page=$nPage>".$lang['general']['nextPage']."</a>";
    }
    else
    {
    $showNext = $lang['general']['nextPage'];
    }if($thisPage->isPre($nowPage))
    {
    $pPage    = $nowPage - 1;
    $showPre  = "<a href=$PHP_SELF?page=$pPage>".$lang['general']['prePage']."</a>";
    }
    else
    {
    $showPre  = $lang['general']['prePage'];
    }$tp->assign("prePage",$showPre);
    $tp->assign("nextPage",$showNext);
    //------------------------------------------------------------------//打印结果
    $tp->display();/*
    *中间文件的显示结束
    *//**
    *写尾文件
    *write the foot file in the template
    */
    include("./foot.php");
    ?>
      

  4.   

    <table class="normal" width="700">
        <!-- BEGIN topicList -->
    <tr height="18" class="dark">
    <td rowspan="2" width="150"><img src="./images/face/{showImg}" width="80" height="80" border="0" alt=""><br><a href="mailto:{showEmail}" title="{emailToMe}">{showName}</a></td>
    <td align="left">&nbsp;&nbsp;&nbsp;&nbsp;{showTitle}
    &nbsp;&nbsp;<a href="data.php?action=delete&topicID={showTopicID}"><font size="2" color="red">{delete}</font></a>
    &nbsp;<a href="reply.php?topicID={showTopicID}"><font size="2" color="red">{reply}</a></font></td>
    </tr>
    <tr height="100" class="light">
    <td align="left" style="WORD-BREAK: break-all" valign="top">
    &nbsp;&nbsp;&nbsp;&nbsp;{showContent}
    <br><br>
    <table border="0" align="right" width="320">
    <tr class="dark">
    <td align="left"><font size="2" color="red">
    {replyTopic}: </font>{replyContent}
    </td>
    </tr>
    </table>
    </td>
    </tr>
        <!-- END topicList -->
    </table>
    <table cellpadding="2" cellspacing="2" width="700">
    <tr height="18">
        <td align="right">{prePage}&nbsp;&nbsp;{nextPage}</td>
    </tr>
    </table>
    <br>