Server Format Extension

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default 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="&lt;\?\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

  2. Similar Questions and Discussions

    1. 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...
    2. 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....
    3. 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...
    4. 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,...
    5. 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"....
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139