Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
Neo719 #1
Server Format Extension
I figured out how to add a server format that would include two functions --
addslashes(htmlentities({data element}))
The only remaining issue is it changes to a php icon in design view. Anyone
know where/how that display is determined so I can get a standard dynamic data
display {dynamic.data} in design view.
For any who are interested, or if it pertains to my question, here are the
code modifications:.
In Formats.xml I copied and modified htmlentities to look like this:
<format title="Encode - HTML Encode and Backslashed" file="SimpleMultiFunc"
expression="<\?\s*php\s*echo\s*addslashes\(html entities\([^\r\n]*\)\);?\s*\?&
gt;" func="addslashes-htmlentities"
id="DWMenu_ServerFormatDef_PHPMySQL_URLENCODE" />
I copied and modified Simple.html and Simple.js to SimpleMultiFunc.html and
SimpleMultiFunc.js.
I modifed SimpleMultiFunc.html to point to SimpleMultiFunc.js, and modified
SimpleMultiFunc.js as follows:
previous code...
if (iEnd > -1)
{
// The one and only argument is the function to ASP function to call.
var cnt = funcCnt(format.func);
var funcEnd = '';
for (i=0; i<cnt; i++) {
funcEnd = funcEnd+")";
}
var insFunc = format.func.replace(/-/g,"(");
ret = str.substring(0, iStart) +
((str.charAt(iStart-1) != " ")? " " : "") +
insFunc + "(" + str.substring(iStart, iEnd) + funcEnd +
str.substr(iEnd);
}
Remaining code ...
Added function:
function funcCnt(str) {
var tmpstr = str.split('-');
return tmpstr.length;
}
It is the same as the simple data formats except that it splits the functions
on a - separator and inserts each function and the appropriate number of
closing parenthasis before and after the data source.
Neo719 Guest
-
Server Behavior/asp/extension
I purchased an extension that will allow me to give the users an option to down an word doc from my site and save it locally. To do this required a... -
VB Date functions into ISO format for SQL server
Hi everyone, I am developing a advertising portal site for villa rentals. In which we require to charge for advertising on a 6 or 12 month basis.... -
Web Server Connector and Format Files
There needs to be a mother of all threads on here regarding configuration of FileMaker Web Server Connector. The FM docs are incomplete and inexact... -
Format Files and Web Server Connector
I'm moving some databases onto an Xserve running Apache and the Web Server Connector, and am wondering if I can retain my cdml_format_files folder,... -
Date Format for other locale settings SQL Server
Hello, I have problems with Storing Dates into SQL Server. I am using ASP 3.0 to do so. When I change my locale settings to "Chinese - Taiwan".... -
Chris - DreamDev #2
Re: Server Format Extension
Try creating a translator edml file and see if that works. Look at the ones in "Configuration\Translators\PHP_MySQL" and it should do what you want.
Chris - DreamDev Guest
-
Neo719 #3
Re: Server Format Extension
Thanks for the input. I have not messed with the EDML files so I will do a
little research in the API.
This is a different extension from anything I have previously done. Any advice
on how to do it in a way that does not involve editing the core/default
dreamweaver files would be much appreciated.
I assume the way I have done this would not be considered the "proper" way to
accomplish the task.
Thanks again...
Neo719 Guest
-
ChrisBank #4
Re: Server Format Extension
You'll be adding your own edml file to do the translation. You should just use
the ones in that folder as an example. Without testing the code it, my guess is
it should look something like:
<participant name="transDynDataMyFormat">
<translator priority=400>
<searchPatterns>
<searchPattern><![CDATA[echo]]></searchPattern>
<searchPattern><![CDATA[addslashes]]></searchPattern>
<searchPattern
paramNames="innerArg"><![CDATA[/\s*php\s*echo\s*addslashes\(htmlentities\(([^\r\
n]*)\)\);?\s*/i]]></searchPattern>
</searchPatterns>
<translations>
<translation whereToSearch="directive" translationType="dynamic data">
<openTag>MM_DYNAMIC_CONTENT</openTag>
<display><![CDATA[{@@innerArg@@}]]></display>
<closeTag>MM_DYNAMIC_CONTENT</closeTag>
</translation>
<translation whereToSearch="tag+INPUT" limitSearch="attribute+VALUE"
translationType="dynamic data">
<attributes>
<attribute><![CDATA[mmTranslatedValueDynValue="VALUE={@@rinnerArg@@}"]]></attrib
ute>
</attributes>
</translation>
</translations>
</translator>
</participant>
I think the only tricky part is the paramNames on the search pattern just name
the paren() matches from the regex. You'll see I added an extra () instead the
call the htmlentities which tells the regex whatever is found in this section
and name it innnerArg, which gets used below in the output.
ChrisBank Guest
-
Neo719 #5
Re: Server Format Extension
Hi Chris,
Sorry it has been a little while. Been to busy to return to this, but your code appears to work perfectly. Thanks!
Steven
Neo719 Guest



Reply With Quote

