Library and template functions handle operations that are related to library items and templates, such as creating, updating, and breaking links between a document and a template or library item. Methods of the dreamweaver.libraryPalette object either control or act on the selection in the Assets panel library items, not in the current document. Likewise, methods of the dreamweaver.templatePalette object control or act on the selection in the Assets panel template objects.

dom.applyTemplate()

Availability

Dreamweaver 3.

Description

Applies a template to the current document. If no argument is supplied, the Select Template dialog box appears. This function is valid only for the document that has focus.

Arguments

{templateURL}, bMaintainLink

  • The templateURL argument is the path to a template in the current site, which is expressed as a file:// URL.

  • The bMaintainLink argument is a Boolean value that indicates whether to maintain the link to the original template (true) or not (false).

Returns

Nothing.

Enabler

dom.detachFromLibrary()

Availability

Dreamweaver 3.

Description

Detaches the selected library item instance from its associated LBI file by removing the locking tags from around the selection. This function is equivalent to clicking Detach from Original in the Property inspector.

Arguments

None.

Returns

Nothing.

dom.detachFromTemplate()

Availability

Dreamweaver 3.

Description

Detaches the current document from its associated template.

Arguments

None.

Returns

Nothing.

dom.getAttachedTemplate()

Availability

Dreamweaver 3.

Description

Gets the path of the template that is associated with the document.

Arguments

None.

Returns

A string that contains the path of the template, which is expressed as a file:// URL.

dom.getEditableRegionList()

Availability

Dreamweaver 3.

Description

Gets a list of all the editable regions in the body of the document.

Arguments

None.

Returns

An array of element nodes.

Example

dom.getIsLibraryDocument()

Availability

Dreamweaver 3.

Description

Determines whether the document is a library item.

Arguments

None.

Returns

A Boolean value that indicates whether the document is an LBI file.

dom.getIsTemplateDocument()

Availability

Dreamweaver 3.

Description

Determines whether the document is a template.

Arguments

None.

Returns

A Boolean value that indicates whether the document is a DWT file.

dom.getSelectedEditableRegion()

Availability

Dreamweaver 3.

Description

If the selection or insertion point is inside an editable region, this function gets the position of the editable region among all others in the body of the document.

Arguments

None.

Returns

An index into the array that the dom.getEditbableRegionList() function returns. For more information, see dom.getEditableRegionList().

Example

The following code shows a dialog box with the contents of the selected editable region:

 var theDOM = dw.getDocumentDOM(); 
var edRegs = theDOM.getEditableRegionList(); 
var selReg = theDOM.getSelectedEditableRegion(); 
alert(edRegs[selReg].innerHTML);

dom.insertLibraryItem()

Availability

Dreamweaver 3.

Description

Inserts an instance of a library item into the document.

Arguments

libraryItemURL

  • The libraryItemURL argument is the path to an LBI file, which is expressed as a file:// URL.

Returns

Nothing.

dom.markSelectionAsEditable()

Availability

Dreamweaver 3.

Description

Displays the New Editable Region dialog box. When the user clicks New Region, Dreamweaver marks the selection as editable and doesn’t change any text.

Arguments

None.

Returns

Nothing.

Enabler

dom.newEditableRegion()

Availability

Dreamweaver 3.

Description

Displays the New Editable Region dialog box. When the user clicks New Region, Dreamweaver inserts the name of the region, surrounded by curly braces ({}), into the document at the insertion point location.

Arguments

None.

Returns

Nothing.

Enabler

dom.removeEditableRegion()

Availability

Dreamweaver 3.

Description

Removes an editable region from the document. If the editable region contains any content, the content is preserved; only the editable region markers are removed.

Arguments

None.

Returns

Nothing.

Enabler

dom.updateCurrentPage()

Availability

Dreamweaver 3.

Description

Updates the document’s library items, templates, or both. This function is valid only for the active document.

Arguments

{typeOfUpdate}

  • The optional typeOfUpdate argument must be "library", "template", or "both". If you omit the argument, the default is "both".

Returns

Nothing.

dreamweaver.updatePages()

Availability

Dreamweaver 3.

Description

Opens the Update Pages dialog box and selects the specified options.

Arguments

{typeOfUpdate}

  • The optional typeOfUpdate argument must be "library", "template", or "both", if you specify it. If the argument is omitted, it defaults to "both".

Returns

Nothing.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy