ADOBE SYSTEMS INCORPORATED

Copyright 2001-2002 Adobe Systems Incorporated
All Rights Reserved

NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the Adobe license agreement accompanying it. If you have received this file from a source other than Adobe, then your use, modification, or distribution of it requires the prior written permission of Adobe.


Extension Name: Translate SSI

Folder name: Translate SSI


Description:

This sample demonstrates how to use the JSXTranslator object and how to implement a markup translator. See the documentation for more information on JSXTranslator. A markup translator is called before the GoLive parser parses the file. The translator is able to modify the document markup before it is sent to the parser.

This sample translates the SSI directive include with the virtual attribute. The translator is activated on file extensions htm and html. These are specified in the <jsxtranslator> tag (see below).

The include directive is replaced by the contents of the included file. See the translate() function in the <script> tag (see below).

According to the implementation, the include directive is specified as follows:

<!--#include virtual="file.htm" -->

The virtual attribute specifies the absolute URL for the HTML snippet to include. The translator translates the contents of the src attribute and displays the contents of the file at the location of the include directive.


How to use

  1. Create an HTML snippet and save it as a file (such as snippet.htm). An HTML snippet might be file with contents:
    <p>This is an included paragraph.</p>
  2. Create a new document.
  3. From the Translator Tags Objects Palette, drag the SSI #include object onto the page. This inserts an include directive onto the page.
  4. Highlight the include directive. The Inspector shows the current setting for the virtual attribute.
  5. In the Inspector, set virtual to point to snippet.htm. In document view you will see the contents of snippet.htm displayed in the include directive.
  6. In source view, you can see the include directive.
  7. In Split View (select "Toggle Split View" at the bottom of the Layout window), you can see the <agl:translated> tag contents that this translator extension updates. <agl:translated> is the translation of the include directive.
  8. Save the document, and view the document in a text editor. See the include directive.
  9. Open the document in GoLive. The include directives are translated, and display the contents of the included files.

Note: The virtual attribute for #include is supposed to be an absolute path. To ensure that GoLive writes out an absolute path, turn on Make new links absolute in the Edit > Preferences, General > URL Handling dialog.


Removing the blue color

If you would not like the SSI include objects to be displayed in blue, create an attribute called "blend" set to "no" on to the jsxtranslator object below.


Editing this sample

It is necessary to turn off this extension before editing this file. If the extension is not turned off, include directives that occur in this document will be translated to <agl:translated> tags.


Module Definition:

Scripts:


User Interface Tags:

Image Define images here. These are referenced by the picture attribute of the jsxpaletteentry and jsxpalettegroup tags.

The little icon displayed in the Objects palette tab:

The icon to be displayed in the Objects palette:

Translator Define a translator that imitates server side replacements.

Inspectors Define Inspectors for custom tags

Palette Group Define a new tab for the Object Palette, or add to an existing tab.

JSXLocale Specify localized versions of strings used in menu items, dialogs, alerts, etc.

US DE
include Inspector include Inspektor
Include Link Change Include Link Änderung