Using Master Templates

The simple way

WebEd 9 allows you to have multiple Master templates - one way you can do this is to have two Master pages

  • Home Page Master
  • Following Page Master

This will allow you to select the template you require for each page type, but what happens if say, the header layout needs to change? You now have to edit in two places and it doubles the work required.


The better way

  • Have one Master Template which controls the wrapper or main layout of the page
  • Have two child templates that use the Master as a parent
  • Master
    • Home Page
    • Following Pages

Now you will have all the static layouts like header and footer in one place and easily managed. Plus the layouts for the following and the homepage are in one place and easy to manage. At the time of page creation, you just select the page layout you want.

How this works is:

  • You select the correct page template for the page (say, Home Page)
  • The topmost parent for the page is found (Master)
    • Then all page templates which are children, are added to the HTML sent to the browser
      • Master
        • Home Page
  • Because templates cascade, you can have very complex template structures if needed.
  • Of course, with more complexity comes more maintenance work so we suggest you keep it as simple as possible

Adding Cool Stuff to Specific Pages

Say we have a widget or specific piece of content we need to use in a few places on the site.

  • You could just add a piece of content on each page if you need it
  • Of course, if it changes, you will need to edit it in multiple places.

Using Cascading Templates, this is a snap

First set up your template structure says:

  • Master
    • Home Page
    • Following Page

Then add the widget as a template. You can do this because templates inherit from their parent.

  • Master
    • Home Page
    • Following Page
      • My Very Cool Widget Page

Because the Widget page is just a template, you can control the positioning of the Widget using standard HTML or CSS. Now when you create your new page, you select the My Very Cool Widget template and everything gets rendered correctly due to the Rollup/Hierarchy/Cascade nature of the templates.

Over the long term, your maintenance work will be significantly less as you can easily break things down into simple templates for all kinds of stuff.

  • Master
    • Home Page
    • Following Page
      • My Very Cool Widget Page
    • Products Page
      • Products with Widgets
  • My Special Landing Page Master
    • My Very Cool Form Template