"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