CI integrates Smarty and cismarty. CI integrates Smarty and cismarty1. download the smarty template to the corresponding site; 2. copy the libs directory in the source code to the libraries Directory of the project and change it to smarty3.03. integrate Smarty and cismarty in the libr CI of the Project directory
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 change it to smarty3.0.
3. create the ci_smarty.php file in the libraries folder of the project directory. the content in the file is as follows:
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
// Obtain related configuration items
$ 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 the smarty. php file in the config folder of the project directory. the content is as follows:
5. create a folder templates_c in the directory where the file is located.
6. add the autoload. php file to the configuration folder of the project.
$ Autoload ['libraries'] = array ('ci _ smarty ');
7. create the file MY_Controller.php in the core folder of the project directory as follows: // extend the core control class.
8. test
Controller
View
Step 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 change it to smarty3.0. 3. in the libr Directory of the project...