2017 © Pedro Peláez
 

library zend-phptal

PHPTAL integration for Zend Framework 3

image

xorock/zend-phptal

PHPTAL integration for Zend Framework 3

  • Sunday, August 28, 2016
  • by xorock
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PHPTAL Integration for Zend Framework 3

Provides PHPTAL integration for Zend Framework 3., (*1)

Installation

Install this library using composer:, (*2)

$ composer require xorock/zend-phptal

Then add ZfPhptal to Your module config under the modules key., (*3)

Configuration

The following configuration options, specific to PHPTAL, is consumed by Service Factory:, (*4)


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():, (*5)

<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:, (*6)

module.config.php, (*7)

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., (*8)

Backward compatibility with ZTAL

For backward compatibility with ZTAL Project renderer registers numerous standard variables., (*9)

$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'));

The Versions

28/08 2016

dev-master

9999999-dev

PHPTAL integration for Zend Framework 3

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module zf zf3 phptal

28/08 2016

0.1.1

0.1.1.0

PHPTAL integration for Zend Framework 3

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module zf zf3 phptal

19/08 2016

0.1.0

0.1.0.0

PHPTAL integration for Zend Framework 3

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

module zf zf3 phptal