CI Integration smarty,cismarty_php Tutorial

Source: Internet
Author: User
Tags autoload smarty template

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.