PHP分页
分页类
/**********
| +---------------------------------------------------
| CLASS NAME: PageBar
| +---------------------------------------------------
| Author: Arvan [E-mail:Arvan@5n9.com QQ:8817776]
| Create date: 2003-7-17
| Note:
| Do for pagination
| +---------------------------------------------------
| Warning: no...
| +---------------------------------------------------
**********/
class PageBar
{
var $total;
var $onepage;
var $num;
var $pagecount;
var $total_page;
var $offset;
var $linkhead;
function PageBar($total, $onepage, $form_vars='')
{
$pagecount = $_GET['pagecount'];
$this->total = $total;
$this->onepage = $onepage;
$this->total_page = ceil($total/$onepage);
if (empty($pagecount))
{
$this->pagecount = 1;
$this->offset = 0;
}
else
{
$this->pagecount = $pagecount;
$this->offset = ($pagecount-1)*$onepage;
}
if (!empty($form_vars))
{
相关文档:
1.基本类
//smarty_config.php
<?php
define('TEMPLATE_DIR','templates/');
define('COMPILE_DIR','templates_c/');
define('CONFIG_DIR','configs/');
define('CACHE_DIR','cache/');
?>
//View.class.php
<?php
//配置文件
require_once 'configs/smart_config.php';
//Smarty类
require('smarty/ ......
互联网的今天,AJAX已经不是什么陌生的词汇了。说起AJAX,可能会立即想起因RSS而兴起的XML。XML的解析,恐怕已经不是什么难题
了,特别是PHP5,大量的XML解析器的涌现,如最轻量级的SimpleXML。不过对于AJAX来说,XML的解析更倾向于前台Javascript
的支持度。我想所有解析过XML的人,都会因树和节点而头大。不可否认,X ......
test.php代码: view plaincopy to clipboardprint?
assign("total",$total); //对模版中的变量赋值 $formatted_total = number_format($total); //格式化$total $smarty->assign("formatted_total",$formatted_total); //对模版中的变量赋值 $smarty->display('test1.htm'); //显示页面 ?>
assign("total",$t ......
<?php
/***************************
* 一个非常实用个性的分页类 *
****************************
*****************************实例***********************************
if(!isset($_GET['page'])){$page = 0;}else{$page = $_GET['page'];}
$pagedemo = new pageclass;
$pagedemo->set ......