Respect / Template

Experimental, HTML-only templating engine
Other
38 stars 6 forks source link

Template inheritance #8

Closed augustohp closed 12 years ago

augustohp commented 12 years ago

Described in the next comment.

alganet commented 12 years ago

In Respect\Template, the responsible for maintaining the HTMLs is the template designer, only. The developer should never touch it. "Inheritance" is an obscure word for designers. All they know is HTML, CSS and some selector stuff, mostly.

I've imagined a role model architecture with real valid HTML templates, not chunks:

Products Page (sample): <!doctype html><body><div id="header"></div><div id="products">Some products here.</div></body>

Role Model Page: <!doctype html><body><div id="header">Hi! Welcome to our website</div></body>

$template = new Respect\Template\Html('products.html');
$role_model = new Respect\Template\Html('header.html');
$template['#header'] = $role_model['#header'];

This would lead up to: <!doctype html><body><div id="header">Hi! Welcome to our website</div><div id="products">Some products here.</div></body>

A role model could have more than one block. Is up to the developer to declare how blocks interchange. A designer could come up with a single HTML containing a header, footer, nav and basic site structure to be the projects entire role model.

Implementation could be done with DOMDocumentFragment, DOMDocument->importNode() or both. Not sure.

PS: we need desperately start working with full selectors, not just only IDs.

What do you think?

augustohp commented 12 years ago

I like it a lot! =D I'm a happy panda now!

To me this feature is well defined =)