Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Dynamically Typed:
Using DOM as Template Engine?
May 25, 2004 @ 12:32:45

With PHP, there's always another new templating engine out there popping up each day, but Harry Fuecks might just have an alternative.

Havard has posted an interesting article exploring how the newest incarnations of PHP's DOM extension could be used as a form of template engine for PHP, which is a step in the direction of XMLC (now a possibility for PHP as we've got decent parsers).

This is the mama bear of template API styles (too fine). The DOM breaks up the template into very fine objects (for example attributes of tags are represented as objects). This offers exquisite control over every detail of the template, but the API can be a bit too cumbersome.

His suggestion is more to use the SAX/XML Pull technologies to create templates rather than DOM - parsing XML structures as they come is just more memory-friendly in the long run than DOM.

tagged:

Link:


Trending Topics: