Working with Tag Libraries
Another powerful customization feature built into Dreamweaver is that of libraries. Tag libraries serve as the foundation for code hints, the Tag Chooser, and the Quick Tag Editor. Towards the end of Chapter 3, we looked at various coding options including code hints. You saw that code hints appear as you author you228 (or whatever language you use) in Code view. When you typed the < symbol and pressed the Spacebar between attributes, the code hints menu appeared, allowing you to choose from a variety of tags and attributes supported by specific tags. This organization of tags, attributes, and attribute values is stored in a tag library located in Dreamweaver's Configuration folder. Although the storage mechanism is irrelevant at this point, what is important is the fact that Dreamweaver allows you to access these tag libraries using a unique and easy-to-use dialog.Part V, "Dynamic Web Page Development." In the meantime, let's review the power and flexibility offered by the Tag Library Editor so that you can begin to familiarize yourself with the customization of tags, attributes, and values that appear in the code hints menu. You can open the Tag Library Editor by choosing the Tag Libraries option from the Edit menu (see Figure 5.28).
Figure 5.28. Dreamweaver gives you access to modify and create new tags in the Tab Library Editor dialog.
- Tags :
Displays a hierarchal list of tag libraries, tags, and attributes. Expand and collapse the tree to get a better idea as to the collection of tag libraries, tags, and attributes Dreamweaver supports out of thebox. You can also create your own custom tag libraries, tags, and attributes by selecting the appropriate options from the Add menu, represented by the Add (+) icon. Furthermore, you can delete a tag library by selecting the Remove () icon. - Tag format: Line breaks :
Choosing options from this menu formats the line breaks before, within, and/or after the tag. Experiment with these options and observe the sample in the Preview pane to get an idea as to what your code will look like and what you feel most comfortable with. - Tag format: Contents :
Changes the formatting of the content within the enclosed tag. Options include Not Formatted, Formatted But Not Indented, and Formatted and Indented. - Tag format: Case :
Allows you to set the case in which attributes should be written. Options include Default, Lowercase, Uppercase, and Mixed Case. The Default option depends on the value set in the Default Tag Case menu in the Code Format category of the Preferences window. Choosing Mixed Case opens the Tag Name Mixed Case dialog, which allows you to explicitly set the case of the tag. For example, you may choose to have the first letter uppercase with the remaining letters in lowercase. - Preview :
Displays a simple preview of the formatted tag based on values set in the previously mentioned menus.
The tag library editing mode becomes visible when you select a tag library. Selecting th215 tag library changes the interface, as shown in Figure 5.29.
Figure 5.29. The tag library mode allows you to customize the technologies that the tab library can be used in.
[View full size image]

- Used in :
Check the technologies in which you want your tag library to be available. - Tag prefix :
Technologies such as ASP.NET and JSP rely on precompiled controls written with tag prefixes. As a rule of thumb, the ASP.NET tag prefix is asp: while the JSP tag prefix is jsp:. As you will see later in the book, a text box is represented in ASP.NET as <asp:textbox> where asp: is the tag prefix and textbox is the tag name. This tells the ASP.NET runtime to render a text box, available from the ASP web control library. If your custom tag library is based on a tag prefix, enter that prefix here.
Finally, you can see the features exposed by the attribute editing mode by expanding a specific tag from the tree. To demonstrate this, I'll expand the <a> tag. Doing so displays a list of attributes supported by the <a> tag (see Figure 5.30).
Figure 5.30. Expand a tag from the tree to see all the attributes supported by the tag.
[View full size image]

- Attribute type :
Choose one of ten options from this menu to assign a specific type to the selected or custom made attribute. For instance, choosing the Color option exposes the color picker when the attribute is added; choosing Font displays a list of selectable web-based fonts. - Values :
Selecting the Enumerated option from the Attribute Type menu enables this text box which allows you to enter comma-separated values. With the target attribute selected and the Enumerated attribute type option chosen, the four targets discussed in Chapter 3 become available.
NOTEThe four targets are _top, _blank, _self, and _parent.Again, you probably won't find yourself making too many changes, if any, to th215 tag library. In reality, the Tag Library Editor dialog makes the most sense when you're working with your own custom tags. To create your own tag library complete with tags, attributes, and values, follow these steps:
1. | Start by minimizing any open tag libraries so that you can see your new tag library at the bottom of the list. Click the Add (+) button and select the New Tag Library option from menu. |
2. | When the New Tag Library dialog appears, enter a unique name and click OK. I'll enter Vehicle Tags . The new tag library is added to the bottom of the list. |
3. | Let's add a tag to the library. With the Vehicle Tags library selected, I'll choose the New Tags option from the Add (+) menu. The New Tags dialog appears. |
4. | In the dialog, make sure that the Vehicle Tags option is selected from the Tag library menu. Now enter a new tag name in the Tag Names text box. I'll enter car . Ensure that the Have Matching End Tags check box is checked. This guarantees that after you've added the closing > symbol in Code view, the end tag is automatically added. Click OK. |
5. | As you can see from Figure 5.31, the new tag is added to the Vehicle Tags library. Use the options exposed in this interface to format how the tag is added and formatted in Code view.Figure 5.31. The new tag is added to the tag library.[View full size image] ![]() |
6. | Now you'll want to add attributes for the new tag. To do this, select the tag from the list and choose the New Attributes option from the Add (+) menu. The New Attributes dialog appears. |
7. | Enter the attribute types in the Attributes Names text box (see Figure 5.32). Click OK.Figure 5.32. Enter a unique name that describes the attribute of the tag.![]() |
8. | With the attribute still selected, choose the Enumerated option from the Attribute Type menu. Follow that up by entering comma-separated values (for example, Acura,BMW,Honda,Toyota ) in the Values text box as shown in Figure 5.33.Figure 5.33. Enter a list of comma-separated values in the Values text box.[View full size image] ![]() |
That's it! You've successfully created your own tag library complete with one tag and an attribute for that tag. Click OK to close the Tag Library Editor and return to the Document window.To test your new tag, switch to Code view. In the <body> tag, type the < symbol. The code hints menu immediately becomes available, displaying your <car> tag within the list (see Figure 5.34).
Figure 5.34. Your newly created tag appears in the code hints menu.
[View full size image]
