[转]最原始的Zend Framework整合Smarty简易方法
2011-04-19 22:13
337 查看
文章来源:
http://bbs.zfchina.org/viewthread.php?tid=4&extra=page%3D3
Zend Framework整合Smarty简易方法
Index.php<?php error_reporting(E_ALL | E_STRICT); date_default_timezone_set('Asia/Shanghai'); set_include_path('.' . PATH_SEPARATOR . './library' . PATH_SEPARATOR . './application/models/' . PATH_SEPARATOR . get_include_path()); include "./library/Zend/Loader.php"; include "./library/Smarty/Smarty.class.php"; $smarty = new Smarty(); $smarty -> template_dir = "templates"; $smarty -> compile_dir = "templates_c"; $smarty -> left_delimiter = "{{"; $smarty -> right_delimiter = "}}"; Zend_Loader::loadClass('Zend_Controller_Front'); Zend_Loader::loadClass('Zend_Config_Ini'); Zend_Loader::loadClass('Zend_Registry'); Zend_Loader::loadClass('Zend_Db'); Zend_Loader::loadClass('Zend_Db_Table'); $config = new Zend_Config_Ini('./application /config.ini','general'); $registry = Zend_Registry::getInstance(); $registry -> set('config',$config); $registry -> set('smarty',$smarty); $db = Zend_Db::factory($config->db->adapter,$config->db->config->toArray()); Zend_Db_Table::setDefaultAdapter($db); $frontController = Zend_Controller_Front::getInstance(); $frontController -> setControllerDirectory('./application/controllers'); $frontController -> setParam('noViewRenderer', true); $frontController -> throwExceptions(true); $frontController -> dispatch(); ?>
IndexController.php
<?php class IndexController extends Zend_Controller_Action { public $view; function init() { $this->view = Zend_Registry::get('smarty'); $baseurl = $this->_request->getBaseUrl(); $this->view->assign('baseurl',$baseurl); Zend_Loader::loadClass('Album'); } function indexAction(){ $title = "My Albums"; $this->view->assign('title',$title); $this->view->display('index.html'); } function addAction() { } function editAction() { } function deleteAction() { } } ?>
相关文章推荐
- Zend Framework整合smarty方法
- Zend Framework整合smarty方法
- Zend Framework 整合Smarty 的方法
- Zend Framework整合Smarty方法[转]
- CodeIgniter整合Smarty的方法详解
- Zend Framework 1.10.x 多模块 多引导设置 整合smarty模板
- Zend Framework 整合 Smarty 模板视图
- ThinkPHP3.1+整合Smarty配置方法
- Zend Framework实现Zend_View集成Smarty模板系统的方法
- Zend Framework 整合 Smarty 模板引擎(ZF Study)
- Zend Framework 1.10.x 多模块整合smarty模板
- PHP Yaf 整合 Zend framework 1 和 smarty 2
- mybatis-spring整合之原始dao方法之记录
- Zend Framework 与Smarty 的完美整合!
- Zend Framework实现Zend_View集成Smarty模板系统的方法
- CI框架整合Smarty模板时包含css,js文件的解决方法
- 利用原始方法和二分法查询数组元素
- ucenter整合uc.php接口,discuz上初次注册会员后,即可实现自动登录的方法
- XunSearch中常用方法整合
- [转载]Tortoise SVN使用方法,简易图解