Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply Dreamweaver templates on an existing site

Tags:

dreamweaver

I have an existing site in a path, and I've pointed the DreamWeaver site to it.

Under \templates there is a master.dwt file. But whenever I save this file, none of the html files which should make use of it change. What do I need to do to get DW to update the html files that make use of it? And how does DW know which files should be updated based on the template changing? Does it use an internal store or something because every time I copy the site to another machine, I'll need to link up all the pages to the relevant templates again.

I've tried going into Modify | Templates | Apply, but no templates are listed. I have a .dwt file in the path so why isn't it picking it up??

like image 998
jaffa Avatar asked Feb 14 '12 15:02

jaffa


People also ask

How do I import a template into Dreamweaver?

Select File > Import > Import XML into Template. Select the XML file and click Open. Dreamweaver creates a new document based on the template specified in the XML file. It fills in the contents of each editable region in that document using the data from the XML file.

How do you save an existing HTML file as a Dreamweaver template?

Click File, Click Save as Template... NOTE: If you are prompted to define a site click the cancel button and do the steps in the Preparing and Managing Website lesson under the "Defining a Site Locally" heading before continuing. The Save As Template dialog box opens: A Dreamweaver dialog box appears.

What is the purpose of a Dreamweaver template?

Dreamweaver templates allow you to have a consistent look and feel on all the pages in your site. Using a Dreamweaver template with your site allows you to easily modify and update all the pages in your site at once.


2 Answers

There's several possible issues in play here:

For Dreamweaver to properly recognize the existence of the template, the folder in the root of the site should be Templates and not templates.

Once Dreamweaver "sees" the Template properly you then need to make sure that the proper code is present in the child HTML files so Dreamweaver knows which files to update via the template. This code takes the form of HTML comments scattered throughout the page. You will always have the following line after the <html> tag:

<!-- InstanceBegin template="/Templates/TemplateName.dwt" codeOutsideHTMLIsLocked="false" -->

After that, editable regions are delineated with code that will look like this:

<!-- InstanceBeginEditable name="someregion" -->
stuff you can edit
<!-- InstanceEndEditable -->

Without the above, the child pages will not respond to the template.

Now for the real bad news. Unless the existing pages match up with the template exactly, you are going to have all kinds of problems getting the template to play nicely with the existing content. Doing Modify | Template | Apply Template to the page when the page is already fully formed will generate a dialog box that asks you map the content to the editable regions in the template. But if the rest of the design elements vary from what the template contains, Dreamweaver will preserve those tags alongside what the template will introduce which usually creates a ton of duplicated tags and broken layouts.

You would be FAR better off creating new, blank pages from the Dreamweaver Template and copy/pasting the contents into the editable area and then overwriting the "old" pages with the Save As command.

like image 166
JCL1178 Avatar answered Sep 22 '22 20:09

JCL1178


I just encountered this issue myself. I realize this original question was posted some time ago, but for anyone who might encounter this problem in the future, I am posting my solution.

If the only changes made to the template relate to one or more elements contained in an attached/linked file (such as a CSS style sheet or JS file), which changes Dreamweaver allows directly from the .dwt template itself, using the style boxes at the side/bottom, then Dreamweaver does not perceive any change to the actual .dwt file itself. If you want those changes to "take effect" and apply them to all pages, you might type a change to the .dwt file itself, click "save all" - undo the change and click "save all" again. This step is really not entirely necessary, as the changes to dependent files can be affected to the website by putting the dependent file to the website.

Also, Dreamweaver will apply changes to CSS/JS dependent files, across the board, but may continue to use a cache, until closed and reopened.

like image 24
Bill Avatar answered Sep 22 '22 20:09

Bill