
115
EXTENDING DREAMWEAVER CS4
Insert bar objects
5 Save the file that now contains the JavaScript functions as Strikethrough.js in the Configuration/Objects/Text
folder.
Create the image for the Insert bar
1 Create a GIF image (18 x 18 pixels), as shown in the following figure:
2 Save the file as Strikethrough.gif in the Configuration/Objects/Text folder.
Editing the insertbar.xml file
Next, you need to edit the insertbar.xml file so Dreamweaver can associate these two items with the Insert bar interface.
Note: Before you edit the insertbar.xml file, you might want to copy the original one as insertbar.xml.bak, so you have a
backup.
The code within the insertbar.xml file identifies all the existing objects on the Insert bar.
• Each category tag in the XML file creates a category in the interface.
• Each menubutton tag creates a pop-up menu on the Insert bar.
• Each button tag in the XML file places an icon on the Insert bar and connects it to the proper HTML file or
function.
Add the new object to the Insert bar
1 Find the following line near the beginning of the insertbar.xml file:
<category id="DW_Insertbar_Common" MMString:name="insertbar/category/common"
folder="Common">
This line identifies the beginning of the Common category on the Insert bar.
2 Start a new line after the category tag; then insert the button tag and assign it the id, image, and file attributes
for the Strikethrough object.
The ID must be a unique name for the button (following standard naming conventions, use
DW_Text_Strikethrough for this object). The image and file attributes simply tell Dreamweaver the location of
the supporting files, as shown here:
<button id="DW_Text_Strikethrough"
image="Text\Strikethrough.gif"
file="Text\Strikethrough.htm"/>
3 Save the insertbar.xml file.
4 Reload the extensions (see “Reloading extensions” on page 78).
The new object appears at the beginning of the Common category on the Insert bar.
Komentáře k této Příručce