beautypg.com

Repeating code blocks with the loop directive – Adobe Dreamweaver CC 2014 v.13 User Manual

Page 550

background image

To the top

Just after the recordsets

Just above the tag

Custom position

Below the Tag

Before the end of the file

Before the recordset close

After the recordset close

After the tag

Custom position

Relative to a Specific Tag

Select a tag from the Tag pop-up menu, and then choose from
the tag positioning options.

Relative to the Selection

Before the selection

After the selection

Replace the selection

Wrap the selection

To specify a custom position, you must assign a weight to the code block. Use the Custom Position option when you need to insert more than one
code block in a particular order. For example, to insert an ordered series of three code blocks after the code blocks that open recordsets, you
would enter a weight of 60 for the first block, 65 for the second, and 70 for the third.

By default, Dreamweaver assigns a weight of 50 to all recordset-opening code blocks inserted above the tag. If the weight of two or more
blocks match, Dreamweaver randomly sets the order among the blocks.

Position a code block (general instructions)

1. Using the Server Behavior Builder, write a code block.

2. In the Server Behavior Builder dialog box, select a position in which to insert the code block from the Insert Code pop-up menu.

3. In the Server Behavior Builder dialog box, select a position relative to that which you selected in the Insert Code pop-up menu.

4. If you complete the authoring of the code block, click OK.

The server behavior is listed in the Server Behaviors panel (Window > Server Behavior); click the Plus (+) button to view the server
behavior.

5. Test the server behavior and ensure that it functions properly.

Position a code block relative to another tag on the page

1. In the Insert Code pop-up menu, select Relative To A Specific Tag.

2. In the Tag box, enter the tag or select one from the pop-up menu.

If you enter a tag, don’t include the angled brackets (<>).

3. Specify a location relative to the tag by choosing an option in the Relative Position pop-up menu.

Position a code block relative to a tag selected by the page designer

1. In the Insert Code pop-up menu, select Relative To The Selection.

2. Specify a location relative to the selection by choosing an option in the Relative Position pop-up menu.

You can insert your code block just before or just after the selection. You can also replace the selection with your code block, or you can
wrap the code block around the selection.

To wrap the code block around a selection, the selection must consist of an opening and closing tag with nothing in between, as follows:

Insert the opening tag piece of the code block before the selection’s opening tag and the closing tag piece of the code block after the
selection’s closing tag.

Repeating code blocks with the loop directive

To repeat a portion of a code block or the entire code block a number of times, use the following syntax:

543

This manual is related to the following products: