2017 © Pedro Peláez
 

library neartal

PHP HTML5 template engine losely based on TAL specification

image

stefanobalocco/neartal

PHP HTML5 template engine losely based on TAL specification

  • Wednesday, January 8, 2014
  • by stefanobalocco
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

NearTAL

A php template engine based on TAL, an attribute-based template engine. This version is a fork from my previous project "SmallTAL", and utilize data- attributes to allow the templates to be html5 complaint., (*1)

There is at least two other php tal implementation (PHPTAL, for example), but this implementation was written thinking about size and speed; tal templates are converted into php code (without the inner data), allowing to reuse them without the need of future conversion. Each time a template is requested, if the template/metal file/neartal source was modified after the template compilation, the library recompile the template into php code. The template engine uses a personal fork of the ganon html5 parser (http://code.google.com/p/ganon/ http://github.com/StefanoBalocco/ganon)., (*2)

It's licensed under a BSD-like license., (*3)

Using

To use NearTAL you need to do:, (*4)

1) Create a temp directory, a cache directory and a template directory, (*5)

2) Template directory should have this structure: | Templates +-- TemplateName.metal.html < macros for the template +--| TemplateName +-- PageName.html, (*6)

3) Use the library in your project, for example:, (*7)

include( 'NearTAL.php' ); $data_required_by_the_template = array ( 'variabile' => 'a value', 'arrayVariable' => array ( 'some data', 'some other data' ) ); $nearTALpaths = array ( 'temp' => '/path/to/temp/directory', 'template' => '/path/to/the/template/directory', 'cache' => '/path/where/cache/file/will/be/stored' );, (*8)

$returnValue = NearTAL( "TemplateName", "PageName", $data_required_by_the_template, $nearTALpaths );, (*9)

If you want to obtain the template in a variable, you should use ob_start()/ob_get_clean()., (*10)

You can look the NearTAL.Tests.php (it's a PHPUnit test case) file and/or the tests folder., (*11)

Unsupported TAL/TALES features

This is a minimal TAL template engine, optional features isn't supported. Also on-error isn't supported., (*12)

TAL specification: http://wiki.zope.org/ZPT/TALSpecification14 TALES specification: http://wiki.zope.org/ZPT/TALESSpecification13 METAL specification: http://wiki.zope.org/ZPT/METALSpecification10 Owlfish TAL, TALES and METAL reference: http://www.owlfish.com/software/simpleTAL/tal-guide.html, (*13)

The Versions

08/01 2014

dev-master

9999999-dev http://github.com/StefanoBalocco/NearTAL

PHP HTML5 template engine losely based on TAL specification

  Sources   Download

MIT-like

The Requires

  • php >=5.2.0

 

templating html5 template engine tal zope