Home > Backend Development > PHP Tutorial > CI integration Smarty

CI integration Smarty

WBOY
Release: 2016-07-29 09:12:57
Original
821 people have browsed it

1. Download the smarty template from the corresponding site;

2. Copy the libs directory in the source code to the libraries directory of the project and rename it to smarty3.0

CI integration Smarty

3. In the libraries folder of the project directory Create a new file ci_smarty.php with the following content:

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;                                                                                                 ;load->config('smarty'); //Load smarty's configuration file
                                               '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'); ;cache_lifetime = $this->ci->config->item('lefttime');
}
}

4. Create a new smart.php file in the config folder of the project directory. The content is as follows :



5. Create a new folder templates_c in the directory where the entry file is located

6. In the project configuration folder, add

CI integration Smarty$autoload['libraries'] = array('ci_smarty' ; Medium

The above introduces CI integration with Smarty, including the require content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template