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

Create a PHP Translator

Guest
Nov 03, 2007 Nov 03, 2007

Copy link to clipboard

Copied

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?
TOPICS
Extensions

Views

998
Translate

Report

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
LEGEND ,
Nov 03, 2007 Nov 03, 2007

Copy link to clipboard

Copied

"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

Votes

Translate

Report

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
Nov 03, 2007 Nov 03, 2007

Copy link to clipboard

Copied

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.

Votes

Translate

Report

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
LEGEND ,
Nov 03, 2007 Nov 03, 2007

Copy link to clipboard

Copied

"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

Votes

Translate

Report

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
Nov 03, 2007 Nov 03, 2007

Copy link to clipboard

Copied

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?

Votes

Translate

Report

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
LEGEND ,
Nov 03, 2007 Nov 03, 2007

Copy link to clipboard

Copied

"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?




Votes

Translate

Report

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
Nov 03, 2007 Nov 03, 2007

Copy link to clipboard

Copied

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?

Votes

Translate

Report

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
LEGEND ,
Nov 04, 2007 Nov 04, 2007

Copy link to clipboard

Copied

LATEST
"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

Votes

Translate

Report

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