php试用smarty和ADODB实现对数据分页读取
<?php
define('BASE_PATH',$_SERVER['DOCUMENT_ROOT']);
define('SMARTY_PATH','\smartTest\Smarty\\');
require BASE_PATH.SMARTY_PATH.'Smarty.class.php';
/*$dir2的这种路径显示到表现页是这下面字符串是一样,导致smarty找不到templates路径*/
//$dir2 = "../Smarty/tempplates/";
class SmartyProject extends Smarty{
function SmartyProject(){
/*必须加这个parent::__construct();,否则,Smarty不会被构造,truncate等不能用,
* 但这似乎没有道理,但事实上,
* 这么做确实解决了truncate不能使用的问题*/
parent::__construct();
$this->template_dir = BASE_PATH.SMARTY_PATH.'/templates/';
$this->compile_dir = BASE_PATH.SMARTY_PATH.'/templates_c/';
$this->config_dir = BASE_PATH.SMARTY_PATH.'/configs/';
$this->cache_dir = BASE_PATH.SMARTY_PATH.'/cache/';
}
}
class ConnDB{
var $dbtype;
var $host;
var $user;
var $pwd;
var $dbname;
var $debug;
var $conn;
function ConnDB($dbtype, $host, $user, $pwd, $dbname, $debug=FALSE){//构造函数
$this->dbtype=$dbtype;
$this->host=$host;
$this->user=$user;
$this->pwd=$pwd;
$this->dbname=$dbname;
$this->debug=$debug;
}
function GetConnId(){
require BASE_PATH.'/smartTest/adodb5/adodb.inc.php';//将adodb的主文件引用进来
if($this->dbtype == 'mysql'){
$this->conn = NewADOConnection('mysql');
$this->conn->Connect($this->host, $this->user, $this->pwd, $this->dbname);
}else if($this->dbtype == 'mssql'){
相关新闻>>
- 发表评论
-
- 最新评论 更多>>