Using the Optimize HTML Dialog Box

All is not lost. An Optimize HTML dialog box, as seen in Figure 29.3, can be implemented on any page in your site and used to quickly clean up the HTML. Anything not specifically controlled by FrontPage-related features can be modified with this powerful tool. The tool can be called at any time (and as many times as needed) in the design process.

Figure 29.3. The Optimize HTML dialog box gives you considerable strength in optimizing your FrontPage HTML.

graphics/29fig03.gif

NOTE

Once you have set a page to optimize HTML a certain way, all code produced from that point on will follow the rules you set.


Optimize HTML Dialog Box Properties

Each option in the Optimizing HTML dialog box will optimize certain elements of your HTML.

The first series of elements deals with HTML comments. Dynamic Web Templates, layout tables, cell formatting, scripting, and general HTML can contain a considerable amount of comments. These comments are only for the developer's reference and contain no information to help render the HTML. Selecting any of these items will simply erase the comment HTML from the Web page.

The second series deals with HTML whitespace. If you look at the HTML in a Web page, the HTML is usually lined up nicely, allowing a user to easily find the area or information he is looking for. If you would like, you can eliminate leading whitespace (spacing and tab whitespace) or all of your HTML whitespace, resulting in a Web site that is simply a single line of code. Whitespace is only an aesthetic element with the single purpose of making HTML code easier to read by developers. Figures 29.4 and 29.5 show how powerful this tool is.

Figure 29.4. HTML in FrontPage 2003 before the whitespace is removed.

graphics/29fig04.jpg

Figure 29.5. The same HTML in FrontPage 2003 after all whitespace is removed.

graphics/29fig05.jpg

TIP

Certain scripting elements do not allow the elimination of all whitespace. If this is the case, FrontPage will leave the script as it needs to appear.


Older versions of FrontPage (and sloppy developers) can often produce a considerable amount of unused HTML information. This includes similar adjacent tags, empty tags, and unused styles. Toggling these options from the Remove Unused Content area will help you rid your pages of these elements.

The last area of this tool removes HTML specifically generated by FrontPage. These include image tracing, interactive button, generator and progid tags, VML content, and World HTML. You can have FrontPage eliminate these tags with the click of a button.

NOTE

The Remove Generated HTML does not remove all FrontPage specific HTML such as Theme and navigational elements. Using this tool will not eliminate all traces of FrontPage-specific HTML from your Web site.


Warnings and Considerations

TIP

If you are going to do considerable modification of your site HTML, backing up your content is always a good idea.


It might seem beneficial for all users to optimize every HTML element on every page in their Web site. However, there are reasons why this isn't the case.

In addition to the reasons listed previously, you might find that you want to optimize your HTML when your site is published. This gives you the benefit of simple layout, meta information, and extensive commenting combined with the thinnest possible code at your site's final destination. We discuss HTML optimization at publish time later in this chapter.

HTML comments have the dual purpose of reminding you what you were thinking in the development process and enabling other users tasked with working on your project an insight into your development process. Eliminating your comments could result in a few bits of HTML eliminated but a few hours of design work when you (or another) try to "figure out" your coding.

Eliminating whitespace requires the same considerations. It might seem like a great idea at the time, but can result in a coding nightmare when trying to come back and make sense of a large Web page made of a single line of HTML.

The removal of unused content has little affect at any point in the design process. You can optimize for unused content at any time without having to worry that the loss of such data would affect your site in any way.

TIP

If you remove generated HTML that kills elements that you need to edit, you can regenerate the elements from within FrontPage. Just run the specific tool within FrontPage that creates the elements and fill in the needed data.


Using Optimize HTML on Older Web Pages

Previous versions of FrontPage produced code that was considerably less than optimized. This was shown previously in Figure 29.1. Opening a site designed in previous versions of FrontPage and optimizing a page at a time can quickly result in sites with cleaner code that often run faster.

Don't ever "assume" that code cleaned with FrontPage's Optimize HTML tool will perform exactly as the original code. Double-check that your optimized efforts produce the effect you are looking for before you save the file as final. HTML can be a tricky little beast, and the assumption of anything without verification is never a good idea.



Special Edition Using Microsoft Office FrontPage 2003
Special Edition Using Microsoft Office FrontPage 2003
ISBN: 0789729547
EAN: 2147483647
Year: 2003
Pages: 443

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