< Day Day Up > |
This section details the functions that are methods of the MMHttp object. MMHttp.clearServerScriptsFolder()Availability Dreamweaver MX. Description Deletes the _mmServerScripts folder and all its files under the root folder for the current site, which can be local or remote. The _mmServerScripts folder is located in Configuration/Connections/Scripts/server-model/_mmDBScripts folder. Arguments serverScriptsfolder
Returns An object that represents the reply from the server. The data property of this object is a string that contains the contents of the deleted scripts. If an error occurs, Dreamweaver reports it in the statusCode property of the returned object. Example The following code, in a menu command file inside the Configuration/Menus folder, removes all the files from the _mmServerScripts folder when it is called from a menu: <!-- MENU-LOCATION=NONE --> <html> <head> <TITLE>Clear Server Scripts</TITLE> <SCRIPT src="/books/4/533/1/html/2/ClearServerScripts.js"></SCRIPT> <SCRIPT LANGUAGE="javascript"> </SCRIPT> <body onLoad="MMHttp.clearServerScriptsFolder()"> </body> </html> MMHttp.clearTemp()Description This function deletes all the files in the Configuration/Temp folder, which is located in the Dreamweaver application folder. Arguments None. Returns Nothing. Example The following code, when saved in a file within the Configuration/Shutdown folder, removes all the files from the Configuration/Temp folder when the user quits Dreamweaver: <html> <head> <title>Clean Up Temp Files on Shutdown</title> </head> <body onLoad="MMHttp.clearTemp()"> </body> </html> MMHttp.getFile()Description This function gets the file at the specified URL and saves it in the Configuration/Temp folder, which is located in the Dreamweaver application folder. Dreamweaver automatically creates subfolders that mimic the folder structure of the server; for example, if the specified file is at www.dreamcentral.com/people/index.html, Dreamweaver stores the index.html file in the People folder inside the www.dreamcentral.com folder. Arguments URL, {prompt}, {saveURL}, {titleBarLabel}
Returns An object that represents the reply from the server. The data property of this object is a string that contains the location where the file is saved, which is expressed as a file:// URL. Normally, the statusCode property of the object contains the status code that is received from the server. However, if a disk error occurs while Dreamweaver is saving the file on the local drive, the statusCode property contains an integer that represents one of the following error codes if the operation is not successful:
Example The following code gets an HTML file, saves all the files in the Configuration/Temp folder, and then opens the local copy of the HTML file in a browser: var httpReply = MMHttp.getFile("http://www.dreamcentral.com/people/profiles/scott.html", false); if (httpReply.statusCode == 200){ var saveLoc = httpReply.data; dw.browseDocument(saveLoc); } MMHttp.getFileCallback()Description This function gets the file at the specified URL, saves it in the Configuration/Temp folder inside the Dreamweaver application folder, and then calls the specified function with the request ID and reply result. When saving the file locally, Dreamweaver automatically creates subfolders that mimic the folder structure of the server; for example, if the specified file is at www.dreamcentral.com/people/index.html, Dreamweaver stores the index.html file in the People folder inside the www.dreamcentral.com folder. Arguments callbackFunction, URL, {prompt}, {saveURL}, {titleBarLabel}
Returns An object that represents the reply from the server. The data property of this object is a string that contains the location where the file was saved, which is expressed as a file:// URL. Normally the statusCode property of the object contains the status code that is received from the server. However, if a disk error occurs while Dreamweaver is saving the file on the local drive, the statusCode property contains an integer that represents an error code. See MMHttp.getFile() for a list of possible error codes. MMHttp.getText()Availability Macromedia Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description Retrieves the contents of the document at the specified URL. Arguments URL, {serverScriptsFolder}
If an error occurs, Dreamweaver reports it in the statusCode property of the returned object. MMHttp.getTextCallback()Availability Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description Retrieves the contents of the document at the specified URL and passes it to the specified function. Arguments callbackFunc, URL, {serverScriptsFolder}
If an error occurs, Dreamweaver MX reports it in the statusCode property of the returned object. MMHttp.postText()Availability Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description Performs an HTTP post of the specified data to the specified URL. Typically, the data associated with a post operation is form-encoded text, but it could be any type of data that the server expects to receive. Arguments URL, dataToPost, {contentType}, {serverScriptsFolder}
If an error occurs, Dreamweaver reports it in the statusCode property of the returned object. Example In the following example of an MMHttp.postText() function call, assume that a developer has placed the myScripts.cfm file in a folder named DeployScripts, which is located in the Configuration folder on the local computer: MMHttp.postText( "http://ultraqa8/DeployScripts/myScripts.cfm", "arg1=Foo", "application/x-www-form-urlencoded", "Configuration/DeployScripts/" ) When Dreamweaver executes this function call, the following sequence occurs:
MMHttp.postTextCallback()Availability Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description Performs an HTTP post of the text to the specified URL and passes the reply from the server to the specified function. Typically, the data associated with a post operation is form-encoded text, but it could be any type of data that the server expects to receive. Arguments callbackFunc, URL, dataToPost, {contentType}, {serverScriptsFolder}
If an error occurs, Dreamweaver reports it in the statusCode property of the returned object. |
< Day Day Up > |