php xml留言板 xml存储数据的简单例子(2)


<?php
require("_class.xmldb.inc.php");
$xmldb = new xmldb("./my_xmldb.xml");
if(isset($_POST["btnform1"])){
    $xmldb -> insert_message($_POST["nickname"],$_POST["content"]);
}
$pagesize        = 3;
$page            = !empty($_GET['page']) ? intval($_GET['page']) : 1;
$rowscount        = $xmldb -> get_node_length("Rows");
$pagecount        = ceil($rowscount/$pagesize);
$start            = ($page-1)*$pagesize > $rowscount ? $rowscount : ($page-1)*$pagesize;
$rowslist = $xmldb -> get_message_list($start,$rowscount,$pagesize);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE> New Document </TITLE>
    <style type='text/css'><!--
        #messagelist ul li{ float:left;list-style-type:none; }

--></style><style type='text/css' bogus="1">        #messagelist ul li{ float:left;list-style-type:none; }
    </style>
</HEAD>
<BODY>
    <div>
    <?php
        if(!empty($rowslist))
        {
            foreach($rowslist as $key => $value)
            {
                echo "<ul><li>".$value["Nickname"]." <span>(".date("Y-m-d H:i",$value["Timer"]).")</span></li>";
                echo "<li>".$value["Content"]."</li></ul><br>";
            }
        }
    ?>
        <div><?=$xmldb -> splitpage($pagecount,$page,'','page',$pagesize)?></div>
    </div>
    <div>
        <form action="" method="post">
            昵称:<input type="text"><br>
            内容:<textarea>


php操作xml的简单留言板,带分页,仅供参考

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/4d7874ba783e944cd3ff811c44d01129.html