Using template blocks in XHTML

Template blocks are a common feature used in many template engines, such as Smarty. Basically, a template block usually looks like this:

<!-- BEGIN element -->
    element
<!-- END element -->

We can use the same syntax in XHTML while preparing our static files for later using in a dynamic environment. Example:

<!-- BEGIN branding -->
   <div id="branding">

  </div>
<!-- END branding -->

By doing so, we achieve the result of writing more flexible and reusable template files, which is very handy when it comes to converting them into something dynamic (such for example the inclusion in a CMS).

Leave a Reply

Note: Only a member of this blog may post a comment.