Removing Template Markup


As I mentioned earlier, when you apply template data to your pages, Dreamweaver adds markup code indicating where template regions should begin and end. Depending on how complex your template is and how many different regions it contains, this markup can be considerable, which affects the download speeds of your pages.

In addition, the template markup does provide information about your site's structure, naming conventions that you use, and the simple fact that the pages were created based on a template.

If you are concerned about bandwidth or you want to conceal the information stored in the template markup, you might consider removing the markup before you publish your pages to the web. Dreamweaver offers several different ways to remove the markup, each having a slightly different effect. Be aware, also, that after your template markup is removed, Dreamweaver no longer can perform automatic updates to the page when the template is updated.

Clean Up HTML

The Clean Up HTML command, found under Commands, Clean Up HTML, enables you not only to remove your template markup, but to run a check on other aspects of your code as well. Depending on how in-depth you want Dreamweaver to get when analyzing your code, you can check any or all of the options (see Figure 27.16).

Figure 27.16. The Clean Up HTML dialog box enables you to check and remove unnecessary code.


The option that removes template markup is the Dreamweaver Special Markup option. To apply the cleanup, click the OK button and, if you chose to display one, Dreamweaver provides a log of the changes that were made to the page.

Export Without Markup

The second option you have for removing template markup is to use the Export Without Markup command. This command exports the entire site to another folder, removing all the template markup as it goes. The nice thing about this feature is that it ensures that all the pages in your site are as bandwidth-friendly as possible. In addition, when you use this command, your original site is left intact with the markup in place while the copy of the site is created with all template and library references removed. Be aware, however, that this command affects your entire site, so don't use it if you want to remove markup from only a single page.

To export your site without markup, choose Modify, Templates, Export Without Markup from the menu bar. In the Export Site Without Template Markup dialog box, shown in Figure 27.17, choose a folder to receive the export and indicate whether you want to keep the original template data files or extract only changed files. Click OK to export the site.

Figure 27.17. Using this dialog box, you can export your entire site without template markup.


Detach Page from Template

The third option for removing markup is one that can be used on a page-by-page basis. Suppose you have a page that you need to have a similar look and feel to the rest of your site, but you also need to change some of the elements that would normally be protected by the locked regions in your template. Not a problem. Dreamweaver enables you to create a new page based on the template and then detach it from the template so that your page structure will match that of the template to start, and locked regions won't stop you from making changes to the page. In addition, after the page is detached from the template, all template markup is removed.

To detach a page from a template, choose Modify, Templates, Detach from Template from the menu bar. After they are detached from the template, all template regions are removed and the page becomes fully editable again (see Figure 27.18).

Figure 27.18. The page has been detached and all template regions have been removed.


In addition, with the page detached from the template, switch to the code view and you'll notice that the template markup has been removed and the code is now fully editable again (see Figure 27.19).

Figure 27.19. The code has become editable and the template markup has been removed.




Special Edition Using Macromedia Studio 8
Special Edition Using Macromedia Studio 8
ISBN: 0789733854
EAN: 2147483647
Year: 2003
Pages: 337

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