Show If File Exists

The purpose of the Show If File Exists server behavior is to display a certain region of content only if a file exists in a certain location. The folder and file name are specified through the user interface. Before applying it, create a recordset containing the table column to be used, and then select a region containing data in Dreamweaver's editable area. If the region is empty, an error message will pop-up requesting to select some data.

You can access this server behavior from the Application panel, Server Behaviors -> + -> MX Kollection -> Conditional Regions -> Show If File Exists.

The user interface has two tabs. Directions about their correct configuration are given below.

 

To set the dialog box options for the first tab, follow the next steps:

  1. In the File folder text-box enter the location where the file used in the condition is located. You can either type its name, browse for it, or construct its name from dynamic data using mark-ups. Use the InterAKT Dynamic Data lighting bolt icon if using the last option.

  2. In the Recordset drop-down menu select a beforehand created recordset containing the field into which is stored the file name. If the file name is not stored in a table field, you can leave this menu on its default value

  3. In the Field drop-down menu select from the recordset fields the one that stores the file name. If the file name is not stored in a table field, leave this menu set to None. If you select None: Rename rule, the Renaming rule text box will be enabled.

  4. In the Renaming rule text-box enter the name of the file to check, or construct it by pressing the InterAKT Dynamic Data icon and select mark-ups.

  5. The Has ELSE checkbox determines whether aside the initial content displayed if the file exists, an alternative region will be created and displayed in case the file does not exist. If the Has ELSE option has been checked, you will have to replace the Else text: replace this with the content that should appear when the file does not exist.

  6. The three buttons in the top right corner of the interface offer you the next functionalities:
    · Click OK when you are done configuring the server behavior.
    · Click Cancel to exit without applying the new settings.
    · The Help button opens this help page.
    These buttons are common to both tabs of the Show If File Exists server behavior interface.

  7. Click on the Advanced tab to continue with configuring the server behavior.
 

 

To set the dialog box options for the second tab, follow the next steps:

  1. In the Name text-box enter the region's name, which must be unique on page. Only modify the default, unique name only if you have special needs regarding the region's name. If you do not have any special requirements regarding the region's name, you can skip configuring this tab.
  2. The Has ELSE checkbox has the same functionality as the one in the Basic tab, allowing the creation of the alternative region to be displayed when the file does not exist.
  3. Click OK when you are done configuring the server behavior.
 

After applying this server behavior, at least one translator is shown on page: the one surrounding the initial region. If the Has ELSE option has been checked, then a second translator containing a bogus content ("ELSE text: Replace this") will be displayed. Replace this bogus content with the one you want to display when the file does not exist.

In order to change the field that acts as the condition, or to add/remove an ELSE region, simply edit the existing Show If File Exists server behavior from the Server Behaviors tab. When removing an ELSE region, its content will be added after the IF region's content.