Setting new document preferences
Click the Preferences button at the bottom left of the New Document dialog box. Alternatively, choose Preferences from the Edit menu (Dreamweaver menu on a Mac), and select the New Document category. Either presents you with the New Document Preferences dialog box shown in Figure 1-3.
The dialog box lets you set the following global preferences:
■ Default document lets you choose the type of document that will be created when you use the keyboard shortcut for a new document (Ctrl+N/Cmd+N). For this to work, you must deselect the option at the bottom labeled Show New Document dialog box on Control+N/Cmd+N. Otherwise, the dialog box shown in Figure 1-2 will appear.
■ Default extension affects only (X)HTML files. Change the value only if you want to use .htm to maintain unity with the naming convention of older sites.
■ Default Document Type (DTD) sets the default DOCTYPE declaration for all new web pages. You cannot set one value for, say, .html and another for .php pages.
- Figure 1-3. The New Document category of the Preferences panel
Changed
■ Default encoding lets you choose the character set to be used in all web pages. The Dreamweaver CS3 default is Unicode (UTF-8). (In the Mac version, this is listed as Unicode 4.0 UTF-8.) This is different from previous versions. The checkbox below this option tells Dreamweaver to use the same character set to display existing pages that don't specify a particular encoding. It doesn't insert any extra coding in such pages.
■ Unicode Normalization Form is required only when using UTF-8 for encoding. It should normally be set to C (Canonical Decomposition, followed by Canonical Composition), and the Include Unicode Signature (BOM) checkbox should be deselected. If you use any other encoding, set Unicode Normalization Form to None.
Choosing the default document type Many people misunderstand the purpose of the DTD (the DOCTYPE declaration before the opening <html> tag). It simply tells the browser how you have coded your page and is intended to speed up the correct rendering of your design. It's not a badge of honor or magic spell that somehow renders your web pages future-proof. The default setting in Dreamweaver CS3 is XHTML 1.0 Transitional, and this is the appropriate choice for most people when creating a new web page as long as you understand the stricter rules imposed by XHTML.
Visit www.w3.org/TR/xhtml1/#diffs to learn about the differences between HTML and XHTML. Also read the frequently asked questions at www.w3.org/MarkUp/2004/xhtml-faq.
The full range of options is as follows:
■ None: Don't use—all pages should have a DOCTYPE declaration.
■ HTML 4.01 Transitional: Choose this if you don't want to use XHTML.
■ HTML 4.01 Strict: This excludes deprecated elements (those destined for eventual elimination)—use this only if you have a good knowledge of HTML and have made a conscious decision not to use XHTML.
■ XHTML 1.0 Transitional: This offers the same flexibility as HTML 4.01 Transitional by permitting the use of deprecated elements but applies the stricter rules of XML.
■ XHTML 1.0 Strict: This excludes all deprecated elements—use this only if you are competent with XHTML.
■ XHTML 1.1: Don't use—this DTD should not be used on pages delivered using the text/html MIME type, the current standard for web servers.
■ XHTML Mobile 1.0: This is a subset of XHTML Basic for mobile devices—you can find the full specification at www.openmobilealliance.org/tech/affiliates/wap/ wap-277-xhtmlmp-20011029-a.pdf.
If you choose an HTML document type, Dreamweaver automatically creates code according to the HTML specification. Similarly, if you choose XHTML, your code automatically follows the stricter rules, using lowercase for tag names and event handlers and inserting a closing slash in empty tags such as <img>. You need to be careful when copying and pasting code from other sources. If you're not sure about the quality of the code, run Commands > Clean Up XHTML, which should correct most, if not all, problems.
If you select a Strict DTD, it's important to realize that Dreamweaver does not prevent you from using deprecated elements or attributes. Dreamweaver expects you to understand the difference yourself.
I Choosing the default encoding The decision to switch the default encoding in
Dreamweaver CS3 to Unicode (UTF-8) makes a lot of sense. Unicode supports nearly every Changed known writing system, so—as long as you have the right fonts on your computer—you can combine Spanish, Russian, Chinese, and English all on the same web page. All modern browsers support UTF-8, so there is no reason you shouldn't use it. But—and it's a big but—this book concentrates heavily on using PHP and the MySQL database. Versions of MySQL prior to the 4.1 series do not support UTF-8. If your hosting company uses MySQL 3.23 or 4.0, you might need to change the default encoding for your web pages. See "Understanding collation" in Chapter 13.
Post a comment