ngyuki / zf2-smarty

Zend Framework 2 的 Smarty 模块

dev-master 2015-04-17 05:45 UTC

This package is auto-updated.

Last update: 2024-09-11 01:16:06 UTC


README

安装

config/smarty.global.php 复制到您的 config/autoload/ 目录。

$ cp vendor/ngyuki/zf2-smarty/config/smarty.global.php config/autoload/

修复 config/autoload/smarty.global.php

<?php
return array(
    'smarty' => array(
        // ...
    ),
);

在您的 application.config.php 中添加 ZendSmarty

<?php
return array(
    'modules' => array(
        'Application',
        'ZendSmarty', // this is it!
    ),

    // ...
);

使用 ZF2 视图助手

{* simple with echo (not support method chain) *}
{url bar [id => 12345]}

{* simple without echo (not support method chain) *}
{do headTitle "Index Page"}

{* method chain *}
{$this->headTitle("ZF2 Smarty")->setSeparator(' - ') nofilter}