
The toolbar command API 241
The name getDynamicContent() is a misnomer because this function should be used even if
the list of entries in the menu is fixed. For example, the Text_Size.htm file in the
Configuration/Menus/MM folder is not a dynamic menu; it is designed to be called from
each one of a set of static menu items. By adding a
getDynamicContent() function that
simply returns the list of possible font sizes, however, the same command file can also be used
for a toolbar pop-up menu. Toolbar items ignore underscores in the strings in a returned array
so you can reuse menu command files. In the menu command file, Dreamweaver ignores the
getDynamicContent() function because the menu item is not marked as dynamic.
Arguments
None.
Returns
Dreamweaver expects an array of strings with which to populate the menu.
Example
function getDynamicContent()
{
var items = new Array;
var filename = dw.getConfigurationPath() + "/Toolbars/MM/
AddressList.xml";
var location = MMNotes.localURLToFilePath(filename);
if (DWfile.exists(location))
{
var addressData = DWfile.read(location);
var addressDOM = dw.getDocumentDOM(dw.getConfigurationPath() +
'/Shared/MM/Cache/empty.htm');
addressDOM.documentElement.outerHTML = addressData;
var addressNodes = addressDOM.getElementsByTagName("url");
if (addressNodes.length)
{
for (var i=0; i < addressNodes.length ; i++ )
{
items[i] = addressNodes[i].address + ";id='" +
addressNodes[i].address + "'";
}
}
}
return items;
Kommentare zu diesen Handbüchern