TIP 133: Creating a Template


Of the four brethren, snippets, components, stationery, and templates, templates are by far the most powerful. By building a template-based site, you can update the entire look of your Web site quickly and easily. Templates require a little more setup than stationery pages, so we devote the next several tips exclusively to the topic of templates.

Editable CSS in the Template Head

Here's a nifty trick: If you have CSS written into a template page, when you make new pages from the template the CSS will be locked. You can't use the Template Regions palette to assign editable regions in the head, but you can go into the source code and add the necessary syntax yourself. Just add <!-- InstanceBeginEditable name="CSS" --> right before the <style> tag and <!-- TemplateEndEditable --> right after the closing </style> tag. Although these regions won't show up in the Template Regions palette, when you create a page from the template you will be able to edit the CSS by double-clicking the CSS head tag in the page.


Note

Another powerful way of making site-wide visual changes is to employ Cascading Style Sheets (see Chapter 5).


The idea behind a template is that certain areas of the page are locked and unchangeable, while other areas are editable. Locked areas typically include the parts of the page that repeat throughout the site, such as navigation bars, while editable regions contain elements that will vary on each page, such as the text.

As you create your template page, you specify which areas of the page are editable via the Template Regions palette, found in the Window menu. To create an editable region, make a selection on the page and then click the Create New Editable Region button in the Template Regions palette. GoLive automatically names text regions according to the first few words in the selection. Other objects are simply named Object or Region. You can rename any region by clicking on its name in the Template Regions palette and pressing Return/Enter, or by clicking a second time (Figure 133a).

Figure 133a. GoLive automatically gives newly created regions a name, but they are easily edited in the Template Regions palette.


You can turn off the automatic naming of regions by disabling Selection Defines Region Name in the Template Regions flyout menu. By turning it off, all new regions will simply be called Region2, Region3, and so on. Editable regions are highlighted on the page in dark green, making them very easy to identify. You can determine a region's location on the page by double-clicking its name in the Template Regions palette, which will show the region with a lighter green highlight (Figure 133b).

Figure 133b. Editable regions that appear light gray here are highlighted in green on your template page.


Templates in the New Dialog

When you choose File > New… the resulting dialog has five categories on the left. When you have a site open that includes template or stationery files, those files will be found in the Favorites section.


Create as many editable regions on the page as you need and then save the page as a template by choosing File > Save as and then clicking Templates from the Site Folder pop-up in the Save dialog box, or choose Save as > Template, from the document's flyout menu. The new template page will appear in both the Templates folder of the Extras tab in the Site window and in the Templates portion of the Library palette.

Note

You must specify at least one editable region on a page before the template will perform like a template. When no editable regions are indicated, GoLive treats the page as a normal page, and you won't be able to create new pages from it.




    Adobe GoLive CS2 Tips and Tricks The 250 Best
    Adobe GoLive CS2 Tips and Tricks The 250 Best
    ISBN: B008CMGJS0
    EAN: N/A
    Year: 2005
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net