Named templates

Posted by Graham Stratton Fri, 12 May 2006 12:34:00 GMT

Named templates are a feature I hear mentioned a bit, but haven’t understood whether I want to use or not. So here’s a little investigation into how to use them and some thoughts about what they might be used for.

Named templates are part of the formlib package, and a suggested use is for forms which might want to have different appearance at different times, though using the same view. Named templates are looked up by view and template name only.

One use for named templates might be in a CMS where you wish to have a couple of default page layouts; say, for example, one type which has a right-side bar for latest news, and one which doesn’t. For each page, you might want the user to be able to select which template to use.

Or you might the top page of your site to have a different template. All the page view would need to do is to check for whether the page implements ISite, and if so use the home page template instead of the default template.

Posted in  | no comments

Comments

(leave url/email »)

   Comment Markup Help Preview comment