Positioning code blocks
When you create code blocks using the Server Behavior Builder (see Using the Server Behavior Builder for more information), you must specify where to insert them in the pages HTML code. The Insert Code and Relative Position pop-up menus let you choose where to insert the code block in the document, and then specify a position relative to another tag in the page.
To learn more about the code block positioning options and how they affect your custom server behavior, see Code block positioning within web pages.
To position a code block (general instructions):
- Using the Server Behavior Builder, write a code block according to the section Using the Server Behavior Builder.
- In the Server Behavior Builder dialog box, select a position in which to insert the code block from the Insert Code pop-up menu.
- In the Server Behavior Builder dialog box, select a position relative to that which you selected in the Insert Code pop-up menu.
- If you have completed the authoring of the code block, click OK.
The server behavior is listed in the Server Behaviors panel (Window > Server Behavior), and can be viewed by clicking the click the Plus (+) button.
- Test the server behavior and ensure that it functions properly.
See Testing server behaviors for more information.
To position a code block relative to another tag on the page:
- In the Insert Code pop-up menu, select Relative To a Specific Tag.
- In the Tag text box, enter the tag or select one from the pop-up menu.
If you enter a tag, dont include the angled brackets (
- Specify a location relative to the tag by choosing an option in the Relative Position pop-up menu.
You can insert your code block just before or just after the opening or closing tags. You can also replace the tag with the code, insert the code as the value of an attribute of the tag (a box appears to let you select the attribute), or insert the code inside the opening tag.
To position a code block relative to a tag selected by the page designer:
- In the Insert Code pop-up menu, select Relative To the Selection.
- 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.
If you want to wrap the code block around a selection, the selection must consist of an opening and closing tag with nothing in between, as follows:
The opening tag piece of the code block is inserted before the selections opening tag and the closing tag piece of the code block is inserted after the selections closing tag.
- About custom server behaviors
- Code block positioning within web pages
- Using the Server Behavior Builder