Справочник Пользователя для Macromedia dreamweaver 8-extending dreamweaver
Server behavior techniques
375
This example might use the following search patterns:
<quickSearch>Response.Write</quickSearch>
<searchPatterns whereToSearch="directive">
<searchPatterns whereToSearch="directive">
<searchPattern paramNames="rs,new__url">
/if\s*\((\w+)\.EOF\)\s*Response\.Redirect\("([^\r\n]*)"\)/i
</searchPattern>
</searchPatterns>
The user might add another test to a particular instance of this code, as shown in the
following example:
following example:
<% if (Recordset1.EOF || x > 2) Response.Redirect("some_url_here") %>
The search patterns fail because they are looking for a parenthesis after the
EOF
parameter. To
make the search patterns more forgiving, you can shorten them by splitting them up, as
shown in the following example:
shown in the following example:
<quickSearch>Response.Write</quickSearch>
<searchPatterns whereToSearch="directive">
<searchPatterns whereToSearch="directive">
<searchPattern paramNames="rs">/(\w+)\.EOF/</searchPattern>
<searchPattern paramNames="new__url">
<searchPattern paramNames="new__url">
/if\s*\([^\r\n]*\)\s*Response\.Redirect\("([^\r\n]*)"/i
</searchPattern>
</searchPatterns>
These shortened search patterns are flexible, so the user can add to the code. However, if the
server behavior changes the URL, when the user clicks OK, the participant is replaced, and
the customizations are lost. To update more precisely, add an
server behavior changes the URL, when the user clicks OK, the participant is replaced, and
the customizations are lost. To update more precisely, add an
updatePatterns
tag that
contains a pattern for updating each parameter:
<updatePatterns>
<updatePattern paramNames="rs">/(\b)\w+(\.EOF)/¬
</updatePattern>
<updatePattern paramNames="new__url">
</updatePattern>
<updatePattern paramNames="new__url">
/(Response\.Redirect\(")[^\r\n]*(")/i
</updatePattern>
</updatePatterns>
In update patterns, the parentheses are reversed and are placed around the text before and
after the parameter. For search patterns, use the
after the parameter. For search patterns, use the
textBeforeParam(param)textAfterParam
parameter. For update patterns, use the
(textBeforeParam)param(textAfterParam)
parameter. All the text between the two parenthetical subexpressions is replaced with the new
value for the parameter.
value for the parameter.