Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Server Format Extension

Participant ,
Jan 21, 2009 Jan 21, 2009
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:.

TOPICS
Extensions
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Jan 23, 2009 Jan 23, 2009
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]]></se...
Translate
Adobe Employee ,
Jan 23, 2009 Jan 23, 2009
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 23, 2009 Jan 23, 2009
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...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 23, 2009 Jan 23, 2009
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@@}"]]></attribute>
</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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 07, 2009 Feb 07, 2009
LATEST
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines