For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > April 2004 > [ANNOUNCEMENT] HTML_Template_Flexy-0.8.0 (beta) Released.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [ANNOUNCEMENT] HTML_Template_Flexy-0.8.0 (beta) Released.
Pear Announce

2004-04-22, 7:33 am

The new PEAR package HTML_Template_Flexy-0.8.0 (beta) has been released at http://pear.php.net/.

Release notes
-------------
Feature addition release:

Moving to stable is posponed another month, so these new features get a thorough testing.

Bugs / Fixes:
* fixed overzealous closing on some tags
* fixed double html escaping of some dynamic attributes
* ignore empty url_rewrite options (eg. images/:/templates/images,,)
* fixed recursion death, on <s> tags
* fixed flexy {variables} inside attributes='that are single quoted'
* unknown namespaces are assumed to be HTML (so XUL with html works ok)

Features:
* Translation2 transparent translation backend support
$options['Translation2'] = array(
'driver' => 'dataobjectsimple',
'options' => array()
)
will instantate Translation2 once , and call it to translate
all strings found when compiling.

* Strings to be translated can be explicitly marked by encapsulating them
in {_( ....... )_}
Parsing is done prior to tokenizing, so you can include {variables} inside
the translation strings.

* Access to private variables and methods now possible eg.
{_myprivate_var}
** requires option['privates'] = true

* Access to super global variables now possible eg.
{_SESSION[lang]} {_GET[posted]} {_POST[posted]}
{_REQUEST[lang]} {GLOBALS[posted]} {_COOKIES[posted]}
** requires option['globals'] = true
(as per all variable, these are html escaped by default, for security reasons,
over-ride with the :h modifier)

* Access to php functions now possible
{GLOBALS.date(mydate,#d/m/y#)}
** requires option['globalfunctions'] = true
** this is a big security hole if you dont trust your template authors,
it exposes exec() etc.

* New Test infrastructure in CVS - enabling better unit testing.

Package Info
-------------
HTML_Template_Flexy started it's life as a simplification of HTML_Template_Xipe,
however in Version 0.2, It became one of the first template engine to use a real Lexer,
rather than regex'es, making it possible to do things like ASP.net or Cold Fusion tags.
However, it still has a very simple set of goals.
- Very Simple API,
o easy to learn...
o prevents to much logic going in templates
- Easy to write document'able code
o By using object vars for a template rather than 'assign', you
can use phpdoc comments to list what variable you use.
- Editable in WYSIWYG editors
o you can create full featured templates, that doesnt get broken every time you edit with
Dreamweaver(tm) or Mozzila editor
o Uses namespaced attributes to add looping/conditionals
- Extremely Fast,
o runtime is at least 4 time smaller than most other template engines (eg. Smarty)
o uses compiled templates, as a result it is many times faster on blocks and loops than
than Regex templates (eg. IT/phplib)
- Safer (for cross site scripting attacks)
o All variables default to be output as HTML escaped (overridden with the :h modifier)
- Multilanguage support
o Parses strings out of template, so you can build translation tools
o Compiles language specific templates (so translation is only done once, not on every request)
- Full dynamic element support (like ASP.NET), so you can pick elements to replace at runtime

Features:
- {variable} to echo $object->variable
- {method()} to echo $object->method();
- {foreach:var,key,value} to PHP foreach loops
- tag attributes FLEXY:FOREACH, FLEXY:IF for looping and conditional HTML inclusion
- {if:variable} to PHP If statement
- {if:method()} to PHP If statement
- {else:} and {end:} to close or alternate If statements
- FORM to HTML_Template_Flexy_Element's
- replacement of INPUT, TEXTAREA and SELECT tags with HTML_Template_Flexy_Element code
use FLEXY:IGNORE (inherited) and FLEXY:IGNOREONLY (single) to prevent replacements
- FLEXY:START/FLEXY:STARTCHILDREN tags to define where template starts/finishes
- support for urlencoded braces {} in HTML attributes.
- documentation in the pear manual

- examples at http://cvs.php.net/cvs.php/pear/HTM..._Flexy/examples

Related Links
-------------
Package home: http://pear.php.net/package/HTML_Template_Flexy
Changelog: http://pear.php.net/package-changel..._Template_Flexy
Download: http://pear.php.net/get/HTML_Template_Flexy-0.8.0.tgz

Authors
-------------
Alan Knowles <alan@akbkhome.com> (lead)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com