脚本宝典收集整理的这篇文章主要介绍了CodeIgniter中使用Smarty3基本配置,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
1.将smarty的libs文件复制到libraries下(这里我重命名为smarty) 2.新建Cismarty.PHP文件。(符合文件规范,文件名的首字母和class名的首字母大写,但是控制器引用加载时,类名/文件名不需要大写)
Cismarty.PHP
<PRe class="brush:PHp;">parent::__construct();
$this->caching = false;
$this->setTemplateDir(APPPATH . 'views/Smarty/templates'); //设定所有模板<a href="https://www.js-code.COM/tag/wenjian/" target="_blank" class="keywords">文件</a>都需要放置的目录地址。
$this->setCon<a href="https://www.js-code.com/tag/fig/" target="_blank" class="keywords">fig</a>Dir(APPPATH . 'views/Smarty/con<a href="https://www.js-code.com/tag/fig/" target="_blank" class="keywords">fig</a>s'); //设定用于存放模板特殊<a href="https://www.js-code.com/tag/PEizhiwenjian/" target="_blank" class="keywords">配置文件</a>的目录,
$this->setCacheDir(APPPATH . 'views/Smarty/cache'); //在启动缓存特性的情况下,这个<a href="https://www.js-code.com/tag/shuxing/" target="_blank" class="keywords">属性</a>所指定的目录中放置Smarty缓存的所有模板
$this->setPluginsDir(APPPATH . 'views/Smarty/plugins'); //<a href="https://www.js-code.com/tag/chajian/" target="_blank" class="keywords">插件</a>目录
$this->setCompileDir(APPPATH . 'views/Smarty/templates_c'); //设定Smarty编译过的所有模板<a href="https://www.js-code.com/tag/wenjian/" target="_blank" class="keywords">文件</a>的存放目录地址
}
}
?>
以上是脚本宝典为你收集整理的CodeIgniter中使用Smarty3基本配置全部内容,希望文章能够帮你解决CodeIgniter中使用Smarty3基本配置所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。