Invalid Domain

You are here :

XSSI if, elif, and else directives
These so-called flow-control elements allow you to make documents display differently depending on the value of variables (such as which browser is being used or the time of day or whatever).

Basic syntax:
<!--#if expr="text_expression" -->
     do what's here
<!--#elif expr="text_expression" -->
     do this instead
<!--#else -->
     do this one
<!--#endif -->

 

How to insert a new if directive
The "Insert XSSI if" dialog has a listing of all the if directives that will be added to the document. Only the directives will be added - the content has to be inserted later through the document window of Dreamweaver or through the HTML inspector. be displayed by default. In this mode, you can specify conditions for each if or elif directive to match certain types of browsers. To do so, select a browser, version, and platform using the pulldown menus.

Advanced patterns
If you need to do something more complex, you can use either "Basic" or "Advanced" modes by selecting the appropriate tab at the top of the dialog box. In Basic mode, you can construct a basic match against variables that have been set in your document, or environmental variables that you have specified. This mode will allow you to set any expression that can be broken down into the following basic syntax: a declared variable, one of the supported operators (=,!=,>,>=,<,<=, or simply test whether or not the variable exists), and the value to match against (expressed as a regular expression).

If the expression you need is more complex - such as a combination of two or more separate expressions - the Advanced mode will be necessary. This mode simply provides a text box in which you can edit the actual contents of the expression directly. You can switch to the advanced view by clicking the "Advanced" tab.

When you click "OK", the directives you have created will be inserted into your document. You will see something like the following:

{ if content goes here } { elif content goes here } { elif content goes here }

Or, if automatic translation of XSSI content is enabled, you will see something like this:

{ elif content goes here }

The text between (and including) the curly braces is editable and should be replaced with the content that you want displayed when the directive that surrounds it is true. Once the page is translated, you will see a maximum of one directive from any block at a time (since only one can be true at any given time).

Editing if directives in your document
To move through the block of if directives in your document, just select any of the invisibles icons () that are part of the block. This will bring up the if block property inspector, which looks like this:

From the inspector, you can modify the current directive in much the same way as when you first inserted it. There are the same three modes (browser, basic, and advanced), which are automatically selected according to the type of expression in the directive, but which can also be selected manually through the tab interface. The inspector can also be used to navigate the if block: Clicking the prev and next buttons will take you to the next appropriate if directive, and, if the document has been translated, it will make that portion of the if block visible (as if the expression were true) and available for editing.

For more information about using if, elif, and else directives (and XSSI in general), take a look at our introduction to XSSI.

Can't find something?
Check out the
JavaScript archive