项目里添加smarty功能步骤
来源:互联网 发布:网络最火尴舞视频 编辑:程序博客网 时间:2024/06/12 10:35
项目里添加smarty功能步骤
1把smarty的libs文件夹拷到项目路径下,并写子类
<?phpdefined('acc')||exit('acc denied');//加载父类文件require(ROOT.'lib/smarty/Smarty.class.php');class mysmarty extends Smarty{public function __construct(){parent::__construct();// 设置模板,编译后文件,缓存 地址$this->setTemplateDir(ROOT.'view/front');$this->setCompileDir(ROOT.'data/comp');$this->setCacheDir(ROOT.'data/cache');$this->caching=true;}}?>2 init文件中引入
require(ROOT.'include/mysmarty.php');
$smarty=new mysmarty();
smarty中自动加载和自己写的自动加载冲突的话
就自己写的__autoload改个名,再在spl_autoload_register中引入函数名,就不会和smarty里的冲突了
function __autoloadshop($class){if (strtolower(substr($class, -5))=='model') {require(ROOT.'model/'.$class.'.class.php');}elseif (strtolower(substr($class, -4))=='tool') {require(ROOT.'tool/'.$class.'.class.php');}else{require(ROOT.'include/'.$class.'.class.php');}}spl_autoload_register('__autoloadshop');
// include('./view/front/index.html');/*$smarty->assgin('new',$new);$smarty->assgin('woman',$woman);$smarty->assgin('man',$man);*/// display不需要地址,只需文件名$smarty->display('index.html');
4到对应的html里换delimiter
0 0
- 项目里添加smarty功能步骤
- Ssh项目添加WebService功能的步骤
- ralink APSOC NFS功能的添加步骤
- PhotonServer添加log功能的步骤
- 一个项目里添加另一个项目
- 在Adobe Reader里添加书签功能
- 在GridView里添加一个功能按钮
- 在GridView里添加一个功能按钮
- windows 安装 smarty 步骤
- Smarty 使用步骤
- smarty配置步骤
- php Smarty 使用步骤
- Smarty 程序撰写步骤
- web项目添加mavean功能
- 新建项目添加到git上步骤
- AS项目添加RecyclerView-v7步骤
- 新建项目添加到git上步骤
- 新建项目添加到git上步骤
- 关于指纹加密算法_MD5加密
- Ubuntu14.04下安装Hadoop2.4.0 (单机模式)
- 堆和栈的区别
- LeetCode 088 Merge Sorted Array
- android studio刚启动报错
- 项目里添加smarty功能步骤
- 1010. 一元多项式求导 (25)
- jQuery效果之可编辑的表格
- 常见排序算法小结
- 51nod 1013 3的幂的和(等比数列求和_快速幂+逆元)
- Android开发-动态添加与button响应(手机拨号界面的实现)
- C语言 折半查找(二分查找)
- 【PAT】1098. Insertion or Heap Sort (25)
- 不能运行Conversion to Dalvik format failed