The link handler will produce a link. It uses a combination of the content of the tag and options to produce the link. In all cases, if provided, the content of the tag will become the content of the link.

The handler is implemented by the LinkHandler class and initialized via the XML Configured Processor.

For example:
becomes: /index.html

The handler understands the difference between internal (to a site) links and external links. If no content is given for the link then the options are used for the url and link content instead.
Handler Options
The handler supports the following options:

urlYesAny valueIf provided this will be the url for the link.
1YesAny valueIf no url option is provided but an anonymous option is provided then this will be used as the link url.
XML Initialization
The init element should contain a templates element that should then contain an internalWrapper element and an externalWrapper element. The internalWrapper template will be used for links internal to the site (those that have a url that does not start with http://). The externalWrapper template will be used for links external to the site, i.e. those that start with http:// or https://.

The init element can optionally contain one or more src elements (see shortcuts).

      <src id="polliwog"
       url="http://polliwog.sourceforge.net" />
      <src id="josql"
       url="http://josql.sourceforge.net/" />
        <externalWrapper><[CDATA[<span><a title="External site, opens in new window" target="_blank" href="[[VALUE]]" [[OPTIONS]] Class="link"><img alt="External site, opens in new window" src="imgs/extlink.gif" border="0" />&#160;[[NAME]]</a></span>]]></externalWrapper>
        <internalWrapper><[CDATA[<a href="[[VALUE]]" [[OPTIONS]] Class="link">[[NAME]]</a>]]></internalWrapper>
To make referencing urls easier the handler supports shortcuts. This is basically a short name that maps to a url prefix (or a full url).

The shortcuts are defined in the init element. The shortcut is defined by using a src element, two attributes id and url are required, the id attribute defines the short name for the shortcut and the url defines the url that it maps to.

[link hoglet,index.html/]
There is no limit to the number of shortcuts that can be defined. Shortcut names are case-sensitive.
Example Usage
  • A link that has content and an anonymous option as the url.
    [link index.html]Home Page[link]
    Would produce: Home Page

  • A link that has no content and an anonymous option as the url.
    [link index.html/]
    Would produce: index.html

  • An external link that has content and uses option: url.
    [link url=http://www.google.com]Google.com[link]
    Would produce: External site, opens in new window Google.com