Home > Articles > Web Development > Perl

  • Print
  • + Share This

Enhancing Templates

A system like this could support multiple templates of the same format by simply varying the name of the file being included with the initial <include> tag. For instance, a different template could be used for each section of the site. The syntax of the <template> tag would stay exactly the same because the format of the tag being defined wouldn't vary at all.

Additionally, templates could incorporate other pages with headlines, news, or other section filler. This works particularly well when adding dynamic listings to a template that are common to the entire site but still generated by Perl code. An <include> tag could be used to load these sections into the template, further abstracting them away from the formatting of the page. This is similar to the component model used by HTML::Mason, which could be used to provide a modular template in the same fashion.

This kind of template file also can support dynamic features that change the format of the page based on attributes passed along with the <template> tag. The section attribute, for example, could be used to choose navigation features. This could be incorporated by adding a conditional using either Perl code or PSP tags. Additional dynamic page elements could be added as needed, but most of them would compromise the ability of site designers to view the page in an HTML editor.

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.