Little background story:

PHPTAL has been accepted as PEAR package, but PEAR requires change of class names from PHPTAL_* to HTML_Template_PHPTAL_*, which would break all existing code for IMHO not a good enough reason.

Therefore I've decided that if I'm having to break existing code, at least I'll make it for a better reason: migration to PHP 5.3 namespaces and PEAR2 (don't worry, I'll maintain PHP 5.2/PEAR1 package for as long as it's needed).

Here's my first try:

*WARNING:* don't install this as a PEAR package! I haven't upgraded build system yet. Just unpack it somewhere and include using absolute path. It's not backwards compatible. Requires PHP 5.3 of course.

There are still some unresolved bugs, e.g. PluginLoader (that loads prefilters) isn't namespace-aware yet and will fail. I've had some problems with Phing and PHPUnit getting confused by namespaces.

Changes required in your code:

use pear2\HTML\Template\PHPTAL;

$tpl = new PHPTAL\PHPTAL();

Classes that were called PHPTAL_Foo_Bar_Baz are now PHPTAL\Foo\Bar\Baz (assuming you add 'use' statement as above to _every_ file that refers to them). Class PHPTAL became PHPTAL\PHPTAL. PHPTAL_VERSION is PHPTAL\VERSION.

I'm not sure what to do with phptal_tales() function and function modifiers. Currently they're in PHPTAL namespace (PHPTAL\phptal_tales()), but it might make sense to move them to global namespace, so that existing modifiers don't need any code changes.

regards, Kornel

PHPTAL mailing list

Reply via email to