MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Especificaciones Pagina 369

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 504
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 368
Server behavior techniques 369
Server behavior techniques
This section covers the common and advanced techniques that create and edit server
behaviors. Most of the suggestions involve specific settings in the EDML files.
Finding server behaviors
Writing search patterns In order to update or delete server behaviors, you must provide a
way for Dreamweaver to find each instance in a document. This requires a
quickSearch tag
and at least one
searchPattern tag, which is contained within the searchPatterns tag.
The
quickSearch tag should be a string, not a regular expression, that indicates that the
server behavior might exist on the page. It is not case-sensitive. It should be short and unique,
and it should avoid spaces and other sections that can be changed by the user. The following
example shows a participant that consists of the simple ASP JavaScript tag:
<% if (Recordset1.EOF) Response.Redirect("some_url_here") %>
In the following example, the quickSearch string checks for that tag:
<quickSearch>Response.Redirect</quickSearch>
For performance reasons, the quickSearch pattern is the beginning of the process of finding
server behavior instances. If this string is found in the document and the participant identifies
a server behavior (in the group file,
partType="identifier" for this participant), the related
server behavior files are loaded and the
findServerBehaviors() function is called. If your
participant has no reliable strings for which to search (or for debugging purposes), you can
leave the
quickSearch string empty, as shown in the following example:
<quickSearch></quickSearch>
In this example, the server behavior is always loaded and can search the document.
Next, the
searchPattern tag searches the document more precisely than the quickSearch
tag and extracts parameter values from the participant code. The search patterns specify where
to search (the
whereToSearch attribute) with a series of searchPattern tags that contain
specific patterns. These patterns can use simple strings or regular expressions. The previous
example code is an ASP directive, so the
whereToSearch="directive" specification and a
regular expression identifies the directive and extracts the parameters, as shown in the
following example:
<quickSearch>Response.Write</quickSearch>
<searchPatterns whereToSearch="directive">
<searchPattern paramNames="rs,new__url">
/if\s*\((\w+)\.EOF\)\s*Response\.Redirect\("([^\r\n]*)"\)/i
</searchPattern>
</searchPatterns>
Vista de pagina 368
1 2 ... 364 365 366 367 368 369 370 371 372 373 374 ... 503 504

Comentarios a estos manuales

Sin comentarios