<?php
// load Smarty library
require('Smarty/Smarty.class.php');
// The setup.php file is a good place to load
// required application library files, and you
// can do that right here. An example:
// require('guestbook/guestbook.lib.php');
class MySmarty extends Smarty {
function MySmarty()
{
// Class Constructor.
// These automatically get set with each new instance.
$this->Smarty();
$basedir=dirname(__FILE__);
$this->template_dir = "$basedir/templates/";
$this->compile_dir = "$basedir/templates_c/";
$this->config_dir = "$basedir/configs/";
$this->cache_dir = "$basedir/cache/";
//$this->compile_check = true;
//this is handy for development and debugging;never be used in a production environment.
//$smarty->force_compile=true;
$this->debugging = false;
$this->cache_lifetime=30;
$this->caching = 0; // lifetime is per cache
//$this->assign('app_name', 'Guest Book');
}
}
?>
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Adodb
{
function Adodb()
{
//$dsn="dbdriver://username:password@server/database"
$dsn = 'mysql://user:password@localhost/xxxx';
require_once("adodb/adodb.inc".EXT);
$this->adodb =& ADONewConnection($dsn);
$this->adodb->Execute("set NAMES 'utf8'");
}
}
?>
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
$obj =& get_instance();
$obj->adodb = new Adodb($obj);
$obj->ci_is_loaded[] = 'adodb';
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
if ( ! class_exists('MySmarty'))
{
require_once(APPPATH.'libraries/mysmarty'.EXT);
}
$obj =& get_instance();
$obj->mysmarty = new MySmarty();
$obj->ci_is_loaded[] = 'mysmarty';
?>
<?php
class Test extends Controller {
function Test()
{
parent::Controller();
$this->load->library('mysmarty');
$this->load->library('adodb');
}
function index()
{
$this->load->library('adodb');
$row = $this->adodb->adodb->getrow('SELECT * FROM admin');
$this->mysmarty->assign("row",$row);
$this->mysmarty->display("test.tpl");
}
}
?>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有