Authoring config.xml
config.xml
file allows portal theme developers to parameterize
portal themes with settings that can be set when the theme is associated with a
portal.The structure of this files is as follows.
Groups
The input configurations are organized into <group> elements. In the User Interface, each group will be rendered as a tab using the group's @label attribute.
Parameter Descriptor Elements
- <string>
- A simple string, without line breaks.
- <password>
- A password or other secret string value. This value will never be displayed in the admin interface, and will be masked when it is modified.
- <text>
- larger amounts of text, with three possible formats
-
@type="html"
- Text is interpreted as HTML code. -
@type="markdown"
- Text is converted to HTML using Markdown rules. -
@type="text"
- Any HTML characters are escaped.
Note: While you almost always should escape strings displayed on portal pages using the?html
directive, you should not do this for <text> parameters, as the appropriate HTML markup will already be built as the value of the parameter. -
- <number>
- A numerical value.
- <checkbox>
- A boolean value.
- <select>
- Enables the user to select a value from a list of possible values. A select element
will have one or more <option> child elements listing the
available values. In addition, the @multi attribute is used to describe
whether multiple values may be selected.
-
@multi="true"
- Select an array of options (including order) from a set -
@multi="false"
- Select a single option from a set (the same effect can be achieved by omitting the@mutli
attribute)
-
- <themeFile>
- Enables the user to select a file from a specific folder in the portal theme. This
is
similar to <select> except that the available
<option> values are derived from the files beneath the
specified folder. Attributes:
- @dir
- The directory path in which to search for files, relative to the folder implied by the @type attribute.
- @type
- Controls the type of file being listed, which controls the base folder for the
@dir attribute as well as how the value is provided when requested.
customPage
- Relative to
/pages/custom
. The value provided to portal pages will be suitable for use with the tag. static
- Relative to
/static
. The value provided to portal pages will be suitable for use with the tag. xsl
- Relative to
/xsl
. The value provided to portal pages will be suitable for use with the tag's @xsl attribute.
- <linkList>
- A container for <link> elements describing links to be displayed somewhere in the UI. Each <link> element carries @href, @label, and @target attributes describing the link to be rendered.
In addition to these inputs, the <instructions> element can be inserted anywhere within a <group> or as the first child of any input. Instructions will be rendered as user-visible text in the form.
Parameter Attributes
All parameters require a @name
attribute which is used to access
them from the Freemarker templates. The @label
attribute is also
recommended and supplies an external label for the parameter that is shown when the
form is
rendered. Authors can hide a parameter (and force each portal to use its default value)
by
setting the @hidden
attribute to true
.
Default Values
The @default
attribute is used to define default values for parameters
(excluding those of type text
, select
, and
linkList
). Defaults for select
elements are define by
setting the @default
attribute on the options desired within the
select
tag. Defaults for text
elements are defined by a
separate <default>
tag within the <text>
tag. The
@default
attribute should be included if possible when writing your
config.xml
, but is not required.
Using Parameters
These parameters must be defined in config.xml
, but may be used anywhere
in the portal theme. Access to these parameters is gained by using the
parameters
collection on the portal
object. For example,
if using a parameter named "stylesheet", it would be accessed with the syntax
portal.parameters.stylesheet
.
<link rel="stylesheet" href="<@td.themeFileUrl value="${portal.parameters.stylesheet}" />"/>
Parameter Configuration DTD
<?xml version="1.0" encoding="UTF-8"?> <!-- =============================================================== --> <!-- Titania Delivery Portal Theme Parameter Descriptor --> <!-- Describes a portal theme's parameters and the User Interface --> <!-- used to populate their values. --> <!-- --> <!-- <!DOCTYPE parameters PUBLIC --> <!-- "-//Titania//DTD Portal Theme Parameter Configuration 1.0//EN" --> <!-- "theme-param-config.dtd"> --> <!-- =============================================================== --> <!ENTITY % commonAtts-nodeflt "name ID #REQUIRED label CDATA #IMPLIED hidden (true|false) 'false' tooltip CDATA #IMPLIED" > <!ENTITY % commonAtts "%commonAtts-nodeflt; default CDATA #IMPLIED" > <!ELEMENT parameters (group)+> <!ELEMENT group (string | text | number | checkbox | select | themeFile | linkList | instructions )*> <!ATTLIST group label CDATA #REQUIRED > <!ELEMENT string (instructions?)> <!ATTLIST string %commonAtts;> <!ELEMENT text (instructions?, default)> <!ATTLIST text %commonAtts-nodeflt; type (text | markdown | html) 'text' > <!ELEMENT default (#PCDATA)*> <!ELEMENT number (instructions?)> <!ATTLIST number %commonAtts;> <!ELEMENT checkbox EMPTY> <!ATTLIST checkbox %commonAtts;> <!ELEMENT select (instructions?, option+)> <!ATTLIST select %commonAtts-nodeflt; multi (true|false) 'false' > <!ELEMENT option (#PCDATA)> <!ATTLIST option default (true|false) 'false' value CDATA #IMPLIED > <!ELEMENT themeFile (instructions?)> <!ATTLIST themeFile %commonAtts; type (customPage | static | xsl) #REQUIRED dir CDATA #IMPLIED > <!ELEMENT linkList (instructions?, link*)> <!ATTLIST linkList %commonAtts-nodeflt; > <!ELEMENT link EMPTY> <!ATTLIST link href CDATA #REQUIRED label CDATA #REQUIRED target (_blank|_self) '_blank' > <!ELEMENT instructions (#PCDATA)*>