CodeIgniter,smarty的使用

<?php defined('BASEPATH') or die('Access restricted!'); class Test extends Controller { function __construct() { parent::__construct(); } function test__() { $this->lang->load('error', 'cn'); echo $this->lang->line('language_key'); } function index() { // $this->output->cache(1); $this->load->library('cismarty'); $dir=array( 'template_dir' => ROOT . '/template/', 'compile_dir' => ROOT . '/templates_c/', 'config_dir' => ROOT . '/config', 'cache_dir' => ROOT . '/cache/' ); $this->load->library('cismarty',$dir); $this->load->helper('text'); $config = array(); if(!$this->cismarty->is_cached('index.tpl')) { $this->cismarty->assign('title', '这是我第一个smarty在CI中的应用!'); $this->cismarty->assign('content', 'smarty和Codeigniter的结合使用:'); $code = file_get_contents(APPPATH.'libraries/Cismarty.php'); // $code=file_get_contents("www.google.com"); $this->cismarty->assign('code',highlight_code($code)); } $this->cismarty->display('demo.html'); // $this->cismarty->clear_all_cache(); } } 

你可能感兴趣的:(cache,function,File,Class,Access)