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.

The star indicating bold lettering is only shown if <strong>the</strong> web currently<br />

being processed ($name) matches <strong>the</strong> current web.<br />

TWikis, in which several groups work simultaneously and thus<br />

have a number of webs, can quickly become complex if <strong>the</strong> entire<br />

list of all webs is always issued. A more elegant solution would be<br />

<strong>the</strong> integration of drop-down menus. For this, we need an HTML<br />

form that is filled with a element:<br />

<br />

<br />

%WEBLIST{ ↵<br />

" ↵<br />

$name"}%<br />

<br />

<br />

Unfortunately, we still have ano<strong>the</strong>r hurdle to clear. Nothing happens<br />

when you select a web. This is due to <strong>the</strong> fact that <strong>the</strong> form is<br />

not sent out. A small JavaScript can come to <strong>the</strong> rescue here. The<br />

following attribute loads <strong>the</strong> URL indicated in value as soon as<br />

anything changes in <strong>the</strong> selection box:<br />

onChange= ↵<br />

"document.location.href= ↵<br />

this.form.selection.options[ ↵<br />

this.form.selection.options.selectedIndex ↵<br />

].value"<br />

Add <strong>the</strong> line in <strong>the</strong> element after<br />

name="selection".<br />

Now we still have <strong>the</strong> problem that <strong>the</strong> Main web is always displayed.<br />

Yet it would be nice if <strong>the</strong> current web in which we are located<br />

would also be preselected. For this, <strong>the</strong> HTML command selected<br />

must be inserted in <strong>the</strong> corresponding option. The<br />

%WEBLIST% <strong>the</strong>n looks like this:<br />

%WEBLIST{ ↵<br />

" ↵<br />

$name" ↵<br />

selection="%WEB%" ↵<br />

marker="selected"}%<br />

As a drop-down<br />

element<br />

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

�<br />

�<br />

239

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

Saved successfully!

Ooh no, something went wrong!