smarty在引导文件中引入:
include_once ("../library/Smarty/Smarty.class.php");
$smarty = new Smarty ();
$smarty->caching = false;
$smarty->template_dir = APPLICATION_PATH."application/views/scripts/";
$smarty->compile_dir = "./data/smarty/";
$smarty->cache_dir = "./data/smarty/cache_c/";
//$smarty->left_delimiter = "<{";
//$smarty->right_delimiter = "}>";
require_once "Zend/Loader/Autoloader.php";
Zend_Loader_Autoloader::getInstance ()->setFallbackAutoloader ( true );
$registry = Zend_Registry::getInstance ();
$registry->set ( 'smarty', $smarty );
引入期间前端控制器的配置:
$front = Zend_Controller_Front::getInstance ();
$front->setBaseUrl ( '/' );
$front->setParam ( 'useDefaultControllerAlways', true );
$front->setParam ( 'noViewRenderer', true );
$front->setControllerDirectory ( '../application/controllers' );
$front->throwExceptions ( true );
$this->view 在控制器中配置:
$this->registry = Zend_Registry::getInstance ();
$this->view = $this->registry ['smarty'];
$this->view->assign ( 'baseurl', $this->_request->getBaseUrl () );
详细解决方案
php之smarty篇(1)-smarty引入
热度:94 发布时间:2012-08-25 10:06:20.0
相关解决方案
- smarty 数据库查询有关问题
- Smarty 的控制器怎么调用其他文件的方法
- smarty section,该如何处理
- smarty 模版中,js修改了表单的值,如其直接在模版中用该表单值进行if语句判断
- smarty 遍历多维数组有关问题
- smarty 截取字符串,调用php中的步骤,foreach循环
- smarty 如若给模板传值是动态的,生成缓存 也是动态
- smarty 怎么实现i++
- smarty 循环,该怎么解决
- smarty 截取字符串解决方法
- php+smarty 为什么在IE上正常,在火狐+IE9上全是源代码?
- php smarty 缓存施用
- smarty options汉语言显示不正常
- Fatal error: Smarty error:syntax error: unrecognized tag,该怎么解决
- smarty section取数据有关问题。求大神
- smarty section如何结束循环
- smarty 关于truncate使用的有关问题
- 使用 $smarty->register_object 报错解决方案
- smarty 怎么查看版本信息?
- Smarty
- smarty 的truncate详细用法。该怎么处理
- php web2.0中的有关问题(php+smarty+zend)
- smarty 分页因缓存出有关问题
- smarty,key从一开始
- php smarty js 设立cookies
- smarty?截取字符串,该如何解决
- smarty?sql 报错
- 初来乍到-smarty
- smarty?section循环报错
- smarty——display传值有关问题