Any new file created using createDocument() or
createXHTMLDocument() is an HTML or XHTML page based on the Default.html or
Default.xhtml file found in the Dreamweaver 9\Configuration\DocumentTypes\NewDocuments folder.
Occasionally, however, a command must make a new non-HTML/XHTML document, such as an XML or
SMIL file or other file type that doesn??™t use the ... structure. To accomplish this task,
TIP TIP
ON the CD-ROM ON the CD-ROM
1024
Extending Dreamweaver Part VII
you first create an HTML file and then replace its entire contents with your own data??”or nothing at all.
The following custom function, developed by Andrew Wooldridge, makes and saves a new, blank text file:
function doNew() {
var newDOM = dreamweaver.createDocument();
var theDoc = newDOM.documentElement;
theDoc.outerHTML = ???.???;
theDoc.innerHTML = ??? ???;
dreamweaver.saveDocument(newDOM, ???../../empty.txt??™);
}
Remember that all the Dreamweaver document functions??”such as saveDocument()??”use addresses
relative to the file calling them. For example, if the doNew() function is included in a command and,
therefore, stored in the Commands folder, the empty.txt document is saved two folders above the
Commands folder in the Dreamweaver root directory, because the full path to it is Dreamweaver
9\Configuration\Commands.
Pages:
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735