Home > Fluid Dynamics Search Engine > Help > 1023

Customizing HTML: How to use variables in templates

Most of the FDSE output is based on template files. These templates allow you to greatly customize the look and feel of your search engine, without editing the source code itself. All of the template files are found in the folder:

	search/searchdata/templates

Templates generally contain straight HTML text. They can also contain variables and conditional statements. The FDSE template parser will replace these variables with actual values when sending output to the visitor.

For example, the title of the output pages is given in the template "header.htm" as:

<title>Fluid Dynamics Search Engine<% if terms %>: %terms% <% end if %></title>

When a visitor goes to the search tips page, there are no search terms defined, so the title that is actually displayed becomes:

<title>Fluid Dynamics Search Engine</title>

When a visitor searches for "foo", the title is:

<title>Fluid Dynamics Search Engine: foo</title>

For more information on using conditional statements, see Customizing HTML: Using Conditional Statements in Templates.

Variables are interpolated case insensitively, and can match multiple times in a single template.

Note: newer versions of FDSE support variables of the forms: %varname%, $varname or __varname__. Older versions, were more restrictive and only supported the "$varname" notation.

For the future, the %varname% notation is preferred, because it is more of a standard. The other notations $varname and __varname__ continue to work but support for them may be dropped in the future.

See also: Customizing HTML: List of all available variables


    "Customizing HTML: How to use variables in templates"
    http://www.xav.com/scripts/search/help/1023.html