Справочник Пользователя для Macromedia dreamweaver 8-extending dreamweaver

Скачать
Страница из 504
374
Server Behaviors
3.
Look for the 
limitSearch
 attribute within the 
searchPattern
 tag.
4.
If the attribute value starts with 
attribute+
, the remaining string is assumed to be the 
attribute name (no spaces are allowed in the attribute name).
If these four steps are successful, Dreamweaver assumes a tag/attribute combination. 
Otherwise, Dreamweaver starts looking for 
searchPattern
 tags with a 
paramName
 attribute 
that has a 
_url
 suffix and a regular expression that is defined. (For information about regular 
expressions, see the 
.)
The following example of a 
searchPatterns
 tag has no search pattern because it combines a 
tag (
cfinclude
) with an attribute (
template
) to isolate the URL for dependency file 
checking, path fixing, and so forth:
<searchPatterns whereToSearch="tag+cfinclude">
   <searchPattern paramNames="include_url" limitSearch="attribute+template" 
/>
</searchPatterns>
The tag/attribute combination (see the previous example) does not apply to translation 
because Dreamweaver always translates to straight text in the JavaScript layer. File dependency 
checking, path fixing, and so on occurs in the C layer. In the C layer, Dreamweaver internally 
splits the document into directives (straight text) and tags (parsed into an efficient tree 
structure).
Updating server behaviors
Replacement update
  By default, participant EDML files do not have an 
<updatePatterns>
 tag, and instances of the participant are updated in the document by 
replacing them entirely. When a user edits an existing server behavior and clicks OK, any 
participant that contains a parameter whose value has changed is removed and reinserted with 
the new value in the same location. 
If the user customizes participant code in the document, the participant might not be 
recognized if the search patterns look for the old code. Shorter search patterns can let the user 
customize the participant code in their document; however, updating the server behavior 
instance can cause the participant to be replaced, which loses the custom edits. 
Precision update
  In some cases, it can be desirable to let users customize the participant 
code after it is inserted in the document. This situation can be achieved by limiting the search 
patterns and providing update patterns in the EDML file. After you add the participant to the 
page, the server behavior updates only specific parts of it. The following example shows a 
simple participant with two parameters: 
<% if (Recordset1.EOF) Response.Redirect("some_url_here") %>