Developer's manual

Choosing a configuration language

There are currently three choices of configuration language - the original client-side javascript, plus PHP and ASP generated versions. This article looks at the benefits of using a server-side configuration, and introduces each of the available frameworks.

The benefits of using a server-side configuration

The main advantage is that it reduces the download size for end users by optimising what they actually download - the stylesheet and script are processed on the server, and only include the code for the features you're actually using - so you get smaller and faster-loading menus.

The output code looks to the browser like regular CSS and javascript, and is cached just the same as it otherwise would be. Depending on the options you use, the total filesize can be as low as 20K! For more details about this particular aspect, please see Reducing the filesize by removing features.

A server-side configuration also has the tremendous advantage that the styling can be generated as pure CSS, so the manual process of generating a noscript stylesheet is no longer required.

Using the PHP scripts

There are two scripts that make up the PHP configuration - the generated stylesheet, udm-style.php, and the generated menu script, udm-dom.php. These are controlled from a configuration file called udm-custom.ini.

Neither the configuration file itself, nor the page that the menu is on, need to be parsed separately by PHP - it's only the two included scripts that do - so you have the freedom to use this configuration language on pages built in a different one.

For more details on implementing the PHP scripts, please see: Adding the scripts (PHP configuration)

Using the ASP scripts

There are two scripts that make up the ASP configuration - the generated stylesheet, udm-style.asp, and the generated menu script, udm-dom.asp. These are controlled from a configuration file called udm-custom.asp.

The scripting is written in JScript, but since it's all in external files you can equally use it on pages written in VBScript. Neither the configuration file itself, nor the page that the menu is on, need to be parsed separately by ASP - it's only the two included scripts that do - so you have the freedom to use this configuration language on pages built in a different one.

For more details on implementing the ASP scripts, please see: Adding the scripts (ASP configuration)

Converting from a current JS configuration

The script comes with a convertor program to convert your javascript configuration into server-side code - it's the file in your udm-resources folder called config-convertor.

Open the program in any fully-supported browser, select the language you wish to convert into, then click the Generate Code button. Paste the generated code into the relevant server-side configuration file, to replace what's already there.

The convertor program reads udm-custom.js for data - if you want it to use a different file, simply change the applicable <script> src in the generator page's source code. The program compiles onload, so when you change the .js file you'll have to refresh the page afterwards.

Although the program does include an option to output ASP, the ASP configuration file is actually identical to the original javascript, with only the addition of <% %> instructions at either end of the file.

Adding the scripts for each configuration

Since you came here from Adding the scripts, you can go straight on to the appropriate next-page:


Search

We would like your feedback! Take the UDM4 Survey!

UDM 4 is valid XHTML, and in our judgement, meets the criteria for WAI Triple-A conformance.

-