xorock/zend-phptal 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xorock/zend-phptal

Composer 安装命令:

composer require xorock/zend-phptal

包简介

PHPTAL integration for Zend Framework 3

README 文档

README

Provides PHPTAL integration for Zend Framework 3.

Installation

Install this library using composer:

$ composer require xorock/zend-phptal

Then add ZfPhptal to Your module config under the modules key.

Configuration

The following configuration options, specific to PHPTAL, is consumed by Service Factory:

return [
    'zfphptal' => [
        'cache_dir' => 'path to cached templates',
        // if enabled, delete all template cache files before processing
        'cache_purge_mode' => boolean,
        // set how long compiled templates and phptal:cache files are kept; in days 
        'cache_lifetime' => 30,
        'encoding' => 'set input and ouput encoding; defaults to UTF-8',
        // one of the predefined constants: PHPTAL::HTML5,  PHPTAL::XML, PHPTAL::XHTML
        'output_mode' => PhptalEngine::HTML5,
        // set whitespace compression mode
        'compress_whitespace' => boolean,
        // strip all html comments
        'strip_comments' => boolean,
        // if enabled, forces to reparse templates every time
        'debug' => boolean,
    ],
];

Using Zend Framework View Helpers

PhptalRenderer proxies to HelperPluginManager by public function plugin($name, array $options = null) or directly with __call():

<a tal:attributes="href php: this.url('sample_route')">link</a>

You can register own plugins in global / module config using ZF 'view_helpers' option key. For example, to register Test plugin:

module.config.php

return [
    'view_helpers' => [
        'aliases' => [
            'test' => \My\View\Helper\Test::class,
        ],
        'factories' => [
            \My\View\Helper\Test::class => \Zend\ServiceManager\Factory\InvokableFactory::class
        ],
    ],
];


// inside template
// ${php: this.test()}

Examples

Example .html files for the skeleton application can be found in the examples folder.

Backward compatibility with ZTAL

For backward compatibility with ZTAL Project renderer registers numerous standard variables.

$this->engine->set('doctype', $this->plugin('Doctype'));
$this->engine->set('headTitle', $this->plugin('HeadTitle'));
$this->engine->set('headScript', $this->plugin('HeadScript'));
$this->engine->set('headLink', $this->plugin('HeadLink'));
$this->engine->set('headMeta', $this->plugin('HeadMeta'));
$this->engine->set('headStyle', $this->plugin('HeadStyle'));

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-08-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固