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.

Accessing <strong>the</strong><br />

View script<br />

Edit link<br />

236<br />

��<br />

��<br />

��<br />

16 Designing a TWiki<br />

Comparing revisions:<br />

� rev1: number of first revision.<br />

� rev2: number of second revision.<br />

Since we want to conceive our scripts for all pages, it is advisable to<br />

proceed as generally as possible. This primarily means replacing statistical<br />

information with <strong>the</strong> corresponding variables when possible.<br />

For instance, <strong>the</strong> View script is <strong>the</strong>n invoked as follows:<br />

%SCRIPTURL%/view%SCRIPTSUFFIX%<br />

The path to <strong>the</strong> script, as well as any defined file endings in<br />

Twiki.cfg are derived from <strong>the</strong> TWiki settings. The name of <strong>the</strong> topic<br />

to be accessed is clearly defined by <strong>the</strong> following variables:<br />

%INCLUDINGWEB%/%INCLUDINGTOPIC%<br />

Note that <strong>the</strong> skin files are actually embedded in <strong>the</strong> article. That is<br />

why it is not enough to use <strong>the</strong> placeholders %WEB% and %TOPIC%,<br />

since <strong>the</strong>y would always point to <strong>the</strong> skin itself. The list of parameters<br />

begins with a ?, and several parameters are separated by a &.<br />

Thus, if you wish to have a link on every page which will display<br />

that page in <strong>the</strong> dragon skin, use <strong>the</strong> following lines:<br />

[[%SCRIPTURL%/view%SCRIPTSUFFIX%/ ↵<br />

%INCLUDINGWEB%/%INCLUDINGTOPIC% ↵<br />

?skin=dragon] ↵<br />

[in Dragon Skin]]<br />

The print view can also be generated with this link, since it basically<br />

opens <strong>the</strong> same page with Print skin. So, you only have to replace<br />

dragon with print in <strong>the</strong> above commands and change <strong>the</strong> label.<br />

The edit script additionally requires <strong>the</strong> current time as a parameter.<br />

You can use <strong>the</strong> variable GMTIME for it:<br />

[[%SCRIPTURL%/edit%SCRIPTSUFFIX%/ ↵<br />

%INCLUDINGWEB%/%INCLUDINGTOPIC% ↵<br />

?t=%GMTIME ↵<br />

{"$year$mo$day$hours$minutes$seconds"}%] ↵<br />

[edit]]<br />

As is <strong>the</strong> case for all TWiki pages, for a complex layout, it is indeed<br />

possible to write it directly in HTML. This also enables you to use

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

Saved successfully!

Ooh no, something went wrong!