Getting a templating mechanism to render the HTML you want.
One of the great things about templating systems is the ability to encapsulate repeatable chunks of code. One of the tough things about templating systems is management of a global “state” to ensure the the overall document that is emitted is as efficient as possible – especially in the HTML world were bandwidth is a performance consideration.
An example of this is where the templating chunks require a particular external resource, like JavaScript. You don’t want each invocation of a repeated sub-template to cause a tag to be emitted; you only need it once for the entire document.
Asp.Net has some handling for JavaScript in their UserControl mechanism (RegisterClientScriptBlock()) that uses a server-side registration mechanism to emit an appropriate document.
Dave Mosher and Brett Zabos, here at VendAsta, have used a pure JavaScript approach to get the JavaScript resources loaded efficiently, built atop the YUI loader. Make sure you check out their escapades.
Filed under: Uncategorized | Leave a Comment
Tags: Projects, VendAsta
No Responses Yet to “Getting a templating mechanism to render the HTML you want.”