Create a PHP Translator

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

  1. #1

    Default Create a PHP Translator

    I would like to create a Dreamweaver Translator which will translater specific
    PHP tags: For example:

    <?php include 'test.php' ?>

    If the tag is equal to the above I want to display something besides the
    normal PHP image that dreamweaver displays. I wrote a translator and in the
    getTranslatorInfo() function I used the expression "<?php" but when the
    translator loads I get an error

    The following translators were not loaded due to errors:
    myphp.htm has information duplicated by another translator.

    So i gather that the dreamweaver transator for <?php conflicts with mine.
    conSo how do i get around this?

    ryanmhuc Guest

  2. Similar Questions and Discussions

    1. CJK Unified unicode translator
      Does any one know of a translator, preferably one implemented in perl, that will translate CJK Unified code points to their respective language...
    2. Tag Translator
      Hi All.. I am working on dreamweaver customization, but Im having problems with the translation issue. I did my own tags and I can easily...
    3. EditTextOnly.htm/translator problem
      I have the following message when one of our users tries to open attempts unsucessfully to log in: "The Following translators were not loaded due...
    4. Is there any Spanish Translator for FreeHand?
      Is there any Spanish Translator for FreeHand 8 or 10, or a Spanish Spell Check?
    5. php to java translator
      Hi Does anyone know if there exists some sort of php to java translator. I dont expect it to produce running code, as I am willing to edit the...
  3. #2

    Default Re: Create a PHP Translator

    "ryanmhuc" <webforumsuser@macromedia.com> wrote in message
    news:fghbjn$hlq$1@forums.macromedia.com...
    > I would like to create a Dreamweaver Translator which will translater
    > specific
    > PHP tags: For example:
    >
    > <?php include 'test.php' ?>
    >
    > If the tag is equal to the above I want to display something besides the
    > normal PHP image that dreamweaver displays. I wrote a translator and in
    > the
    > getTranslatorInfo() function I used the expression "<?php" but when the
    > translator loads I get an error
    >
    > The following translators were not loaded due to errors:
    > myphp.htm has information duplicated by another translator.
    >
    > So i gather that the dreamweaver transator for <?php conflicts with mine.
    > conSo how do i get around this?

    Without more information, I would suggest that you create a more specific
    pattern and since it's PHP code I would also suggest to limit the
    translation to PHP Servermodel related files for speed.
    You can also create a serverbehavior for your code first, and add a
    translation in the EDML, this way you can use the more specific matching
    methods like whereToSearch and quickSearch

    For example: here's a snippet from my custom Repeat region DWMX extension
    (it's ASP but you'll get the idea)

    <participant name="VSS_Repeat_Checkout_begin">
    <translator>
    <searchPatterns whereToSearch="directive">
    <searchPattern paramNames="loopName,rsName" isOptional="false"
    limitSearch="all"><![CDATA[/Dim ([^\r\n]*?)_index(?:\r\n|\r(?!\n)|\n)[
    \t]*[^\r\n]*?_index = 0(?:\r\n|\r(?!\n)|\n)[ \t]*For Each [^\r\n]*? in
    ([^\r\n]*?)\.Checkouts ' repeat Checkouts(?:\r\n|\r(?!\n)|\n)[
    \t]*[^\r\n]*?_index = [^\r\n]*?_index \+
    1(?=\r\n|\r|\n|%>)/i]]></searchPattern>
    <searchPattern requiredLocation="trailing"><![CDATA[/Next ' repeat
    Checkouts ([^\r\n]*?) in
    ([^\r\n]*?)\.Checkouts(?=\r\n|\r|\n|%>)/i]]></searchPattern>
    </searchPatterns>
    <translations>
    <translation whereToSearch="directive" translationType="tabbed region
    start">
    <openTag>MM_REPEATEDREGION</openTag>
    <attributes>
    <attribute><![CDATA[NAME="@@loopName@@"]]></attribute>
    <attribute><![CDATA[SOURCE="@@rsName@@"]]></attribute>
    </attributes>
    <display>MM.LABEL_RepeatTabbedOutlineLabel</display>
    </translation>
    </translations>
    </translator>
    </participant>

    --
    Joris van Lier

    Joris van Lier Guest

  4. #3

    Default Re: Create a PHP Translator

    If i undertand you correctly you suggestioning to create a unique tag. But that
    will not accomplish what i'm looking for. I do not need a work around i need
    the solution. I know its possible to intercept built in tags like the PHP tags
    I just don't know how. Please if anyone knows lend a hand.

    ryanmhuc Guest

  5. #4

    Default Re: Create a PHP Translator

    "ryanmhuc" <webforumsuser@macromedia.com> wrote in message
    news:fgif5k$1op$1@forums.macromedia.com...
    > If i undertand you correctly you suggestioning to create a unique tag. But
    > that
    > will not accomplish what i'm looking for. I do not need a work around i
    > need
    > the solution. I know its possible to intercept built in tags like the PHP
    > tags
    > I just don't know how. Please if anyone knows lend a hand.
    No I was suggesting you write a translation for the php tag including (parts
    of ) it's contents trough EDML, instead of an extra translator.
    perhaps you can explain in more detail what you want to accomplish, why are
    the standard translators insufficient? Or in other words: what is it that
    you'd want to display in addition to the shield, and why?

    Joris

    Joris van Lier Guest

  6. #5

    Default Re: Create a PHP Translator

    The goal is pretty simple. Right a translator which will translate the
    following syntax:

    <? include('test.php') ?>

    The problem is the dreamweavers built in MM_SSI translates this before I can
    get a hold of it. How do I get my translator to run before the MM_SSI
    translator?

    ryanmhuc Guest

  7. #6

    Default Re: Create a PHP Translator

    "ryanmhuc" <webforumsuser@macromedia.com> wrote in message
    news:fgir9c$g08$1@forums.macromedia.com...
    > The goal is pretty simple. Right a translator which will translate the
    > following syntax:
    >
    > <? include('test.php') ?>
    Into what?
    > The problem is the dreamweavers built in MM_SSI translates this before I
    > can
    > get a hold of it. How do I get my translator to run before the MM_SSI
    > translator?
    You can return the priority of the translator as the 7th element of the
    translatorInfo function return object, a higher priority should make your
    translator run before others.
    Do you want to override all includes or just a specific one or set?




    Joris van Lier Guest

  8. #7

    Default Re: Create a PHP Translator

    In this case setting the priority down will not help (I already tried). The
    reason is the MM_SSI translator runs on the text "include" mine runs on "<?".

    I guesss I could set mine to translate the same text but is there a way to
    have one translator run before others regardless of the expression used?

    ryanmhuc Guest

  9. #8

    Default Re: Create a PHP Translator

    "ryanmhuc" <webforumsuser@macromedia.com> wrote in message
    news:fgj17s$n86$1@forums.macromedia.com...
    > In this case setting the priority down will not help (I already tried).
    > The
    > reason is the MM_SSI translator runs on the text "include" mine runs on
    > "<?".
    >
    > I guesss I could set mine to translate the same text but is there a way to
    > have one translator run before others regardless of the expression used?
    According to the documentation you should be able to have your translator
    run before others by configuring a higher value for it's priority. In
    Dreamweaver MX I've found an SSITranslator.DLL in the JSExtensions forlder
    of the application configuration directory, according to the documentation
    I've read these Libraries provide a global object to the Dreamweaver
    application environment whose name is the basename of the library, you might
    try to dump the object (SSITranslator.toSource()) to see if and what
    priority it has configured.

    Joris

    Joris van Lier 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