CI Integration Smarty,cismarty
1. Download the Smarty template to the appropriate site;
2. Copy the Libs directory in the source code into the project's libraries directory and rename it to smarty3.0
3. Create a new file ci_smarty.php within the Libraries folder of the project directory, with the following contents:
Defined (' BasePath ') or exit (' No Direct script access allowed ');
Require_once (APPPATH. ' libraries/smarty3.0/smarty.class.php ');
Class Ci_smarty extends Smarty
{
protected $ci;
Public Function __construct () {
$this->ci = & Get_instance ();
$this->ci->load->config (' smarty ');//Load the Smarty configuration file
Get the related configuration item
$this->template_dir = $this->ci->config->item (' Template_dir ');
$this->complie_dir = $this->ci->config->item (' Compile_dir ');
$this->cache_dir = $this->ci->config->item (' Cache_dir ');
$this->config_dir = $this->ci->config->item (' Config_dir ');
$this->template_ext = $this->ci->config->item (' Template_ext ');
$this->caching = $this->ci->config->item (' caching ');
$this->cache_lifetime = $this->ci->config->item (' lefttime ');
}
}
4. Create a new file smarty.php file within the Config folder of the project directory with the following contents:
5. Create a new folder in the directory where the portal file is located templates_c
6. Under the project configuration folder, add the autoload.php file to the
$autoload [' libraries '] = Array (' Ci_smarty ');
7. Create a new file in the core folder of the project directory my_controller.php content as follows://extended Core control class
8. Testing
In the controller
In the View
http://www.bkjia.com/PHPjc/1064066.html www.bkjia.com true http://www.bkjia.com/PHPjc/1064066.html techarticle CI integration smarty,cismarty 1. Download the Smarty template to the appropriate site; 2. Copy the Libs directory in the source code to the Libraries directory of the project and rename it to smarty3.0 3. In the project directory of LIBR ...