beautypg.com

Path functions, Dreamweaver.absoluteurltodocrelative(), Dreamweaver.getconfigurationpath() – Adobe Dreamweaver API Reference CS5 User Manual

Page 277

background image

272

DREAMWEAVER API REFERENCE

Document

Last updated 8/27/2013

Path functions

Path functions get and manipulate the paths to various files and folders on a user’s hard disk. These functions
determine the path to the root of the site in which the current document resides, convert relative paths to absolute
URLs, and more.

dreamweaver.absoluteURLToDocRelative()

Availability
Dreamweaver 2.

Description
Given an absolute URL and the path to a document, this function converts the absolute URL to a document-relative path.

Arguments

docPathURL

,

siteRootURL

,

absoluteURL

The

docPathURL

argument is the path to a document on the computer of the user (for example, the current

document), expressed as a file://URL.

The

siteRootURL

argument is the path to the site root, expressed as a file://URL.

The

absoluteURL

argument is the file://URL to convert to a document-relative path.

Returns
A string representing the path to the document at

absoluteURL

, expressed relative to the document at

docPathURL

.

Example
In the following example, if the values of

docPathURL

and

siteRootURL

are

file://C:/sites/cherrystreet/archives/october.shtml

and

file://C:/sites/cherrystreet/

respectively, then the return value is

"../includes/header.html"

. Use this value to reference

/includes/header.html

from

/archives/october.shtml

.

var docPathURL = dw.getDocumentDOM().URL;
var siteRootURL = dw.getSiteRoot();
var absoluteURL= dw.relativeToAbsoluteURL(docPathURL, siteRootURL, "/includes/header.html");
var docRelPath = dw.absoluteURLToDocRelative(docPathURL, siteRootURL, absoluteURL);

dreamweaver.getConfigurationPath()

Availability
Dreamweaver 2.

Description
Gets the path to the Dreamweaver Configuration folder, which is expressed as a file:// URL.

For information on how Dreamweaver accesses Configuration folders on a multiuser platform, see “C-Level
Extensibility” in Extending Dreamweaver Help.