Templates
Using templates is increadibly helpful when:
1. working with.larger sites which contain many pages that are similiar - so
no need to repeat the same attributes
2. in attempting to maintain a consistent look through the site
3. in applying changes to the whole set with just one change on the original
template
Up to now I've resisted them foolishly and in the process most likely have doubled
my work load at points.
Thus today, so my error is not replicated, we all will learn to work with templates.
Although I have the official directions below for when you are working on your
own, or when you run into a problem.. we will make our first foray into templatehood
together.
Based on this last weekends experiences, I've found it easiest to first create
your page as you would llike it, add the editable regions, and then save this
document as a template. You can always change the format you need easily, though
it will lose some of it properties of instant upgrading when you do so.
Step 1:
Create a site folder that will contain all the appropriate materials.Import
into this folder the template, some fish images,
I will provide you with an intial template page I created to work with but
later you will create your own!
tropicalfish.dwt
Too add to the page that you will produce from the template a choice of fish
images:
hatchet1web.jpg
dovegreyweb.jpg
blow1web.jpg
blkgreyfinnyweb.jpg
Step 2.:
Normally to Open a new page you would go to the site folder where you created
your template..Open a new page.. then go to Modify>Templates>Apply tempate
to page. Choose the template and then you will have the page in template form
to work with.
To create a template-based document in the New Document dialog box: or to choose
one from the Assets under Window
1. Choose File > New to open the New Document dialog box.
2. In the New Document dialog box, select the Templates tab.
3. In the Templates For list, select the site which contains the template you
want to use.
The site templates list updates to display templates in the selected site.
4. In the list, select the template you want to use.
5. Click Create to create a new template-based page.
The document opens in the Document window.
3. Proceed to put in new information where there are editable regions including
a picture of the fish. Then make sure you save it as a new document and not
save it as modifications to the template itself.
Now create your own template page.
First create a site... Site> new site... go from there
The once you have a site build your own template.. start clean, add in editable
regions and so o n and then save as a template.. You go to Insert> template
objects> editable regions where you want them... everything else is non touchable.
Creating a new Template
. In the Document window, do one of the following to select the region:
• Select the text or content that you want to set as an editable region.
• Place the insertion point where you want to insert an editable region.
2. Do one of the following to insert an editable region:
• Choose Insert > Template Objects > New Editable Region.
• Right-click (Windows) or Control-click (Macintosh) the selected text
or object, and choose New Editable Region from the context menu.
• In the Insert bar, select Templates, then click the Editable Region
button.
The Editable Region dialog box appears.
3. In the Name text box, enter a unique name for the region. (You cannot use
the same name for more than one editable region in a particular template.)
Note: Do not use special characters in the Name field.
4. Click OK.
The editable region is enclosed in a highlighted rectangular outline in the
template, using the highlighting color that is set in preferences
Removing an editable region
If you've marked a region of your template file as editable and you want to
lock it (make it noneditable) again, use the Remove Template Markup
command.
Note: You can't lock a region in a file based on a template; you can lock a
region only in a template file.
To remove an editable region:
1. In the document or in the tag selector, select the editable region you want
to change.
2. Choose Modify > Templates > Remove Template Markup.
Creating a template-based document
Once you set the template design, you apply a template to either a blank document
or a document that already contains content.!!!!
To create a new document based on a template, you can use the Assets panel or
the New Document dialog box. The Assets panel lists templates in your current
Dreamweaver site. You can right-click in the Templates category of the Assets
panel to create a new template, and to create new documents from a template.
In the New Document dialog box, you can select a template from any of your currently
defined Dreamweaver sites to create a new document from. When you create a new
document based on a template, you can choose whether the document remains attached
to the template. By default, when you change a template, all attached documents
update to reflect the template changes. If you deselect the Update Page When
Template Changes option when creating a new document, the new document is created
as stationery: an independent HTML file, with no template regions. Updates to
the template do not change the document.
To create a template-based document in the New Document dialog box:
1. Choose File > New to open the New Document dialog box.
2. In the New Document dialog box, select the Templates tab.
3. In the Templates For list, select the site which contains the template you
want to use.
The site templates list updates to display templates in the selected site.
4. In the list, select the template you want to use.
5. Click Create to create a new template-based page.
The document opens in the Document window.
To create a new document from a template in the Assets panel:
1. Open the Assets panel (F11), if it is not already open.
2. In the Assets panel, click the Templates icon to view your site templates.
Tip: If you just created the template you want to apply, you may need to click
the Refresh button to see it.
3. Right-click the template you want to apply, then select New From Template.
The document opens in the Document window.
Library
Libraries are a way to store page elements such as images, text, and other
objects that you want to reuse or update frequently throughout your web site.
These elements are called library items.
When you place a library item in a document, Dreamweaver inserts a copy of the
HTML source code for that item into the document, and adds an HTML comment containing
a reference to the original, external item. The reference to the external library
item makes it possible to update the content on an entire site all at once by
changing the library item and then using the update commands in the Modify >
Library submenu.
Dreamweaver stores library items in a Library folder within the local root folder
for each site. Each site has its own library; to copy a library item from one
site to another site, use the Assets panel's Copy to Site command. For more
information, see Using the Library category of the Assets panel.
Note: If the library item contains links, the links may not work in the new
site. Also, images in a library item aren't copied to the new site.
Working with Library items
A library is a special Dreamweaver file that contains a collection of individual
"assets" or copies of assets you have created for placement in your
web pages. If you simply want your pages to have the same headers and footers,
yet have different page layouts, use library items to store the headers and
footers. Library items are stored page elements that you can reuse in multiple
pages; you can update all the pages that use a library item whenever you change
the item's contents.
You can store all sorts of page elements, such as images, tables, sounds, and
Flash movies in a library.
When you use a library item, Dreamweaver doesn't insert the library item in
the web page, rather it inserts a link to the library item. If you later need
to make changes to a library item, for example change some text, or an image,
updating the library item automatically updates the instance of the library
in any page in which you've inserted the library item.
Creating a library item
You can create a library item from any element in the body section of a document,
including text, tables, forms, Java applets, plug-ins, ActiveX elements, navigation
bars, and images.
For linked items such as images, the library stores only a reference to the
item. The original file must remain at the specified location for the library
item to work correctly. It can still be useful to store an image in a library
item, though; for example, you could store a complete img tag in a library item,
which would allow you to easily change the image's alt text, or even its src
attribute, throughout the site. (Don't use this technique to change an image's
width and height attributes, though, unless you also use an image editor to
change the actual size of the image.)
To create a library item:
1. Select a portion of a document to save as a library item.
2. Do one of the following:
• Choose Window > Library and drag the selection into the Library category
of the Assets panel.
• Click the New Library Item button at the bottom of the Assets panel
(in the Library category).
• Choose Modify > Library > Add Object to Library.
3. Enter a name for the new library item.
Each library item is saved as a separate file (with the file extension .lbi)
in the Library folder of the site's local root folder.
Inserting a library item in a document
When you add a library item to a page, the actual content is inserted in the
document along with a reference to the library item.
To insert a library item in a document:
1. Place the insertion point in the Document window.
2. Choose Window > Library.
The Assets panel appears, showing the Library category.
3. Drag a library item from the Assets panel to the Document window, or select
an item and click the Insert button.
To insert the contents of a library item without including a reference to the
item in the document, press Control (Windows) or Option (Macintosh) while dragging
an item out of the Library category of the Assets panel. If you insert an item
this way, you can edit the item in the document, but the document won't update
when you update pages that use that library item.