01.12.2012 Views

7 Components: the Function Pages - Developers

7 Components: the Function Pages - Developers

7 Components: the Function Pages - Developers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

12.6<br />

TWiki and JavaScript<br />

Employing JavaScript with your TWiki application is practically effortless.<br />

To circumvent TWiki formatting, <strong>the</strong> JavaScript code<br />

should be masked with an HTML comment and -tags. Here<br />

is an example:<br />

<br />

<br />

<br />

Every time <strong>the</strong> page is accessed, a message box appears indicating<br />

that JavaScript is active.<br />

12.7<br />

TWiki Variables<br />

TWiki variables fulfill two functions. Firstly, <strong>the</strong>y stand for certain<br />

data that is only employed when <strong>the</strong> page is invoked and <strong>the</strong> source<br />

text is displayed in its normal form. For example, <strong>the</strong> placeholder<br />

%DATE% displays <strong>the</strong> current date. This can save <strong>the</strong> author a great<br />

deal of effort, and it makes <strong>the</strong> page more dynamic. Secondly, a few<br />

variables have a switch function. They enable several settings to be<br />

determined in TWiki. For instance, <strong>the</strong> %NOAUTOLINK% variable<br />

determines whe<strong>the</strong>r CamelCase is active or not.<br />

You can identify a variable by <strong>the</strong> fact that its name is enclosed in<br />

percent signs; depending on <strong>the</strong> variable, comments can be inserted<br />

in curly brackets after <strong>the</strong> name, e.g. for an embedded search for<br />

%SEARCH{"fire"}%. There are pre-defined variables that are set<br />

when <strong>the</strong> TWiki system is installed or that access information from<br />

<strong>the</strong> server. O<strong>the</strong>rs can be set by <strong>the</strong> user. Here, we differentiate between<br />

<strong>the</strong> following options with regard to <strong>the</strong> area of validity of <strong>the</strong><br />

variables:<br />

� Variables applicable to <strong>the</strong> entire TWiki. They can be defined<br />

and edited on <strong>the</strong> page TWikiPreferences in <strong>the</strong> TWiki web.<br />

� Variables set for a certain web. They can be found in <strong>the</strong> respective<br />

WebPreferences page.<br />

12.6 TWiki and JavaScript �<br />

�<br />

�<br />

189

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!