Posted Saturday, March 05, 2005 7:08:20 PM by Danilo Celic
Many times you'll need access to similar messages that you present to the user, whether in alerts for errors, or in notes on dialogs in a Dreamweaver extension. You could include the same text over and over again, in all of the extensions you have as part of your project, or you could write your own custom file manipulation functions that would share a common file to store your common text. Well, the great folks that bring you Dreamweaver also thought of this second method, they just happened to not document it just yet, and it's called dreamweaver.loadString().
On my system, I get alerted: iso-8859-1
So, where, and how do you store your strings so that that you can load them when needed?
As usual, you need to get into the Dreamweaver configuration folder. Go to the Configuration/Strings/ folder. You store your data in a specially formatted XML file. See the following code for an example of the format:
<string id="uniqueIdentifier" value="string to store">
You can have multiple <string> tags within the parent <strings> tag.
Make sure that you uniquely identify your strings, preferably by "scoping" the strings by including your company name, or your initials, and also save your strings XML file with a unique name inside the Strings folder. All this is to avoid any naming conflict with other developers, or with built in stings, and strings XML files.
See Community MX content by Danilo Celic