Validating and Testing Your Code


Once you've completed a page, you can use Dreamweaver to verify that the page is validin other words, that it follows the rules for its document type. You can validate page markup for any file, or validate XHTML and XML files as XML.

You can also use Dreamweaver to test your pages by verifying support for target browsers, testing for broken links, and generating reports.

Before you validate your pages, however, you need to use the Validator Preferences pane to configure your validation.

To select Validator preferences:

1.

From the Edit menu (Windows) or the Dreamweaver application menu (Mac), select Preferences. The Preferences dialog appears.

2.

Select the Validator category from the list on the left.

The Validator pane appears (Figure 3.41).

Figure 3.41. The Validator pane of the Preferences dialog.


3.

On the Validator pane, select languages to validate your pages against.

4.

Click the Options button to display the Validator Options dialog (Figure 3.42).

Figure 3.42. The Validator Options dialog.


5.

Deselect any Display options that you don't want the Validator report to include (all options are selected by default).

6.

Deselect any options that you don't want the Validator to check for (both options are selected by default).

Both of these options pertain to character entities. If you want Dreamweaver to check for quotation marks and characters (&, <, and >) in your HTML, leave these options selected.

7.

Click OK to save your selections and close the Validator Options dialog.

8.

Click OK on the Validator pane to save your selections and close the Preferences dialog.

Tips

  • Dreamweaver uses the chosen language on the Validator pane only if the page doesn't include a DOCTYPE to specify the language used to create the page.

  • You can't select multiple versions of the same language on the Validator pane, so choose the earliest version you want to test against.

  • Certain characters in HTML can be represented by a name or number that's known as a character entity. You use character entities to display characters such as angle brackets (< or >) in HTML pages without having them interpreted as part of the code. For example, " represents quotation marks; < represents a left angle bracket (<); & represents an ampersand (&); and > represents a right angle bracket (>).


To validate markup:

1.

Open an HTML page in Dreamweaver.

2.

From the File menu, choose Check Page > Validate Markup, or press Shift-F6.

The Validator report displays on the Validation panel in the Results panel group at the bottom of the Dreamweaver workspace (Figure 3.43).

Figure 3.43. Choose Check Page > Validate Markup to display the Validator report in the Results panel group.


3.

If you want to view the full text of any error or warning in the Validator report, click the More Info button.

Tip

  • In addition to HTML files, you can also validate the markup for ColdFusion files, SMIL (Synchronized Multimedia Integration Language), WML (Wireless Markup Language), and pages with Java server tags. Just select the appropriate language on the Validator pane of the Preferences dialog.


To validate as XML:

1.

Open an XHTML or XML file in Dreamweaver.

2.

From the File menu, choose Check Page > Validate as XML.

The Validator report displays on the Validation panel in the Results panel group at the bottom of the Dreamweaver workspace.

Tip

  • You can click the More Info button (Figure 3.43) on the left of the Validation panel to get the full text of any error or warning in the Validator report. You can also click the Reference tab in the Results panel group to get more specifics on the use of any tag from Dreamweaver's extensive collection of reference books. If you don't see the Reference panel, press Shift-F1 to open it.


Verifying support for target browsers

In addition to validating your pages, you can also test your code with a browser check in your choice of target browsers.

To verify support for target browsers:

1.

Open your page in Dreamweaver.

2.

On the Document toolbar, click the Check Browser button to the right of the title field (Figure 3.44).

Figure 3.44. Click the Check Browser button on the Document toolbar to open the Check Browser menu.


The Check Browser menu opens (Figure 3.45).

Figure 3.45. The Check Browser menu.


3.

From the Check Browser menu, select Settings. The Target Browsers dialog opens (Figure 3.46).

Figure 3.46. Select target browsers in the Target Browsers dialog.


4.

In the Target Browsers dialog, select the minimum version of each browser you want to use for testing your pages. Click OK to save your settings and close the dialog.

5.

Click the Check Browser button again to display the menu. Select Check Browser Support to test the open page.

6.

The results display on the Target Browser Check panel in the Results panel group (Figure 3.47).

Figure 3.47. View the browser-support results on the Target Browser Check panel.


Tip

  • If you select the Auto-check on Open option from the Check Browser menu, Dreamweaver will automatically check browser support every time the document is opened and display a message when you pause your pointer over the Check Browser button, such as "No Browser Check Errors" or "Found 6 Browser Check Errors." You can view the full report on the Target Browser Check panel.


Troubleshooting your code

You can also troubleshoot your code by checking your site for broken links and by using Dreamweaver reports.

To check for broken links:

1.

Open your page in Dreamweaver.

2.

From the Site menu, choose Check Links Sitewide, or press Ctrl-F8 (Windows) or Command-F8 (Mac).

3.

View the results on the Link Checker panel in the Results panel group (Figure 3.48).

Figure 3.48. View details on broken links on the Link Checker panel when you check links sitewide.


Tip

  • You can access the Check Links Sitewide feature only if you have defined a Dreamweaver site.


To use Dreamweaver reports:

1.

Open your page in Dreamweaver.

2.

From the Site menu, choose Reports.

The Reports dialog displays (Figure 3.49).

Figure 3.49. Choose Reports from the Sites menu to display the Reports dialog.


3.

In the Report On drop-down menu, select Current Document to test a single page, or Entire Current Local Site (if you have defined a Dreamweaver site).

4.

In the Select Reports section, select the items you want to test in the Workflow and HTML Reports sections.

5.

Click the Run button to run the report.

6.

View the report results on the Site Reports panel in the Results panel group (Figure 3.50).

Figure 3.50. View report results on the Site Reports panel.


Tip

  • You can also run a report for the selected files in the site, or for a folder by selecting these options from the Report On menu in the Reports dialog.





Macromedia Dreamweaver 8 Advanced for Windows and Macintosh. Visual Quickpro Guide
Macromedia Dreamweaver 8 Advanced for Windows and Macintosh: Visual QuickPro Guide
ISBN: 0321384024
EAN: 2147483647
Year: 2004
Pages: 129
Authors: Lucinda Dykes

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