Difference between revisions of "Parameter System"

From TV-Browser Wiki
Jump to: navigation, search
(Structure: Übersetzung überarbeitet, Schreibfehler korrigiert)
m (Structure: Ergänzung)
Line 18: Line 18:
  
 
  The title is {isset(original_title, title)}
 
  The title is {isset(original_title, title)}
In this case, the original title will be used. If the original title is not available, the title of the broadcast will be shown.
+
In this case, the original title will be used. If the original title is not available, the regular title of the broadcast will be shown.
  
 
Functions can also be nested:
 
Functions can also be nested:

Revision as of 18:23, 22 June 2006

What is the "Parameter System"?

The Parameter System enables dynamically generated texts. For example, this is used in the e-mail plugin to create the body text of an e-mail. In the Capture-Plugin it is used to pass parameters to 3rd party applications like WinTV.

Structure

The structure of the Parameter System is fairly simple. Any text surrounded by { and } will be replaced by variables or function results.

For example, the result of the following text will be:

The title is {title}

when the title of the broadcast is "Coronation Street"

The title is Coronation Street!

You are also able to use functions to combine or split text.

For example:

The title is {isset(original_title, title)}

In this case, the original title will be used. If the original title is not available, the regular title of the broadcast will be shown.

Functions can also be nested:

The title is {clean(isset(original_title, title))}

Now, all special characters will be replaced by underscores "_".

You can also define your own parameter texts:

The original title is {isset(original_title, "not available, so sorry!")}

In this example the original title of the broadcast will be replaced by "not available, so sorry!" if the respective field is empty.

The original title is not available, so sorry!

A complete list of parameters and functions is provided with each plug-in. Why is that? Because each plug-in can add its own functions and parameters.

Special Characters

If you want to use special characters like '\', '{' or '}' they have to be prefixed with a '\' (backslash).

This means:

Input Result
\\ \
\\\\ \\
\{ {
\} }