Macromedia dreamweaver 8-extending dreamweaver User Manual
444
Data Translators
Creating the icon
Next, you create the icon for Poco tags.
To create the icon:
1.
Create an image file that is 18 x 18 pixels for the Poco tags icon.
2.
Save the file as poco.gif in the Configuration/ThirdPartyTags folder.
Creating the attribute translator
You create an HTML file that contains the functions necessary for the attribute translator.
To create the HTML file:
1.
Create a new blank file.
2.
Enter the following:
<html>
<head>
<title>Conditional Translator</title>
<meta http-equiv="Content-Type" content="text/html; charset=">
<script language="JavaScript">
<head>
<title>Conditional Translator</title>
<meta http-equiv="Content-Type" content="text/html; charset=">
<script language="JavaScript">
/*************************************************************
* This translator handles the following statement syntaxes: *
* <# if (condition) then foo else bar #> *
* <# if (condition) then att="foo" else att="bar" #> *
* <# if (condition) then att1="foo" att2="jinkies" *
* att3="jeepers" else att1="bar" att2="zoinks" #> *
* *
* It does not handle statements with no else clause. *
*************************************************************/
* This translator handles the following statement syntaxes: *
* <# if (condition) then foo else bar #> *
* <# if (condition) then att="foo" else att="bar" #> *
* <# if (condition) then att1="foo" att2="jinkies" *
* att3="jeepers" else att1="bar" att2="zoinks" #> *
* *
* It does not handle statements with no else clause. *
*************************************************************/
var count = 1;
function translateMarkup(docNameStr, siteRootStr, inStr){
var count = 1;
// Counter to ensure unique mmTranslatedValues
var outStr = inStr;
// String that will be manipulated
var spacer = "";
// String to manage space between encoded attributes
var start = inStr.indexOf('<# if'); // 1st instance of Pound Conditional
var count = 1;
// Counter to ensure unique mmTranslatedValues
var outStr = inStr;
// String that will be manipulated
var spacer = "";
// String to manage space between encoded attributes
var start = inStr.indexOf('<# if'); // 1st instance of Pound Conditional
code
// Declared but not initalized. //
var attAndValue;
// Boolean indicating whether the attribute is part of
var attAndValue;
// Boolean indicating whether the attribute is part of