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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The second level is that of <strong>the</strong> concrete scripts. They are <strong>the</strong> ones<br />

that ultimately determine which HTML code is issued. To be able to<br />

use <strong>the</strong> elements from <strong>the</strong> master template, you have to integrate<br />

<strong>the</strong>m with %TMPL:INCLUDE{"TWiki"}%. It suffices to indicate<br />

“TWiki” as <strong>the</strong> file name. The respective skin version is automatically<br />

searched.<br />

Tip: If you define a few elements in <strong>the</strong> script templates, you can<br />

link to <strong>the</strong>m in <strong>the</strong> embedded master template. This gives you <strong>the</strong><br />

opportunity to parameterize <strong>the</strong> master templates. An example: In<br />

<strong>the</strong> standard template, <strong>the</strong> function toolbar is placed in <strong>the</strong> footer.<br />

This is defined in <strong>the</strong> master template. However, <strong>the</strong> commands that<br />

are supposed to be <strong>the</strong>re are defined in <strong>the</strong> respective script template<br />

as %TMPL:DEF{"topicaction"}%. Thus, you can basically<br />

use <strong>the</strong> same footer for all scripts.<br />

Of course, one important question is how to place <strong>the</strong> actual topic<br />

text. This is stored in <strong>the</strong> %TEXT% variables. In addition, <strong>the</strong>re are<br />

several o<strong>the</strong>r variables containing content components. A selection<br />

of <strong>the</strong>m is listed in Tab. 16.4:<br />

Name Content<br />

%TEXT% The actual content of <strong>the</strong> page. In <strong>the</strong> edit<br />

and preview modes it appears in raw form.<br />

Caution – <strong>the</strong> corresponding text box is not<br />

included in <strong>the</strong> variable.<br />

%EDITTOPIC% Edit link.<br />

%REVISIONS% Link to <strong>the</strong> last three versions of <strong>the</strong> topic.<br />

%TOPICPARENT% Name of <strong>the</strong> article from which <strong>the</strong> page has<br />

%PREVIEW<br />

BGIMAGE%<br />

been generated.<br />

Path to <strong>the</strong> background image of <strong>the</strong> preview<br />

mode.<br />

Note that not all variables are always filled with content. If you create<br />

your own templates, you should always start from an existing<br />

template and adapt it to your wishes. In this way, you will also see<br />

what variables contain <strong>the</strong> functions you need.<br />

In addition to <strong>the</strong> source text of <strong>the</strong> topics, TWiki also saves socalled<br />

meta information. This is information about <strong>the</strong> page itself, its<br />

attachments, <strong>the</strong> parent page, and any related moves or forms. They<br />

are generally not shown when a page is edited.<br />

Script templates<br />

Placing text<br />

Tab. 16.4<br />

16.1 Designing <strong>the</strong> Look �<br />

�<br />

�<br />

245<br />

Meta information

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

Saved successfully!

Ooh no, something went wrong!