murganikolay/smarty-module

此包已被弃用,不再维护。未建议替代包。

Zend Framework 2 的 Smarty 模板引擎模块

1.2.0 2013-06-12 19:02 UTC

This package is not auto-updated.

Last update: 2022-11-07 20:52:47 UTC


README

SmartyModule 是一个模块,它将 Smarty 模板引擎与 Zend Framework 2 集成。

版本:1.0.0

安装

Composer

  1. "murganikolay/smarty-module": "1.0.0" 添加到您的 composer.json 文件中,并运行 php composer.phar update。
  2. 将 SmartyModule 添加到您的 config/application.config.php 文件中的 modules 键下。

手动安装

  1. 将以下命令在 vendor 目录下执行:git clone https://github.com/MurgaNikolay/SmartyModule.git
  2. 将 Smarty 放入 vendor 目录
  3. 设置自动加载器以加载 Smarty。
  4. 将 SmartyModule 添加到您的 config/application.config.php 文件中的 modules 键下。

配置

按照以下方式更改您的应用程序配置

...
'view_manager' => array(
    'default_suffix' => 'tpl', // <-- new option for path stack resolver
    'display_not_found_reason' => true,
    'display_exceptions'       => true,
    'doctype'                  => 'HTML5',
    'not_found_template'       => 'error/404',
    'exception_template'       => 'error/index',
    'template_map' => array(
        'layout/layout'           => __DIR__ . '/../view/layout/layout.tpl',
        'application/index/index' => __DIR__ . '/../view/application/index/index.tpl',
        'error/404'               => __DIR__ . '/../view/error/404.tpl',
        'error/index'             => __DIR__ . '/../view/error/index.tpl',
    ),
    'template_path_stack' => array(
        __DIR__ . '/../view',
    ),
),
...

有关视图管理器的更多信息:请参阅 Zend\View