Tags:
create new tag
, view all tags
Sometimes it's useful to have a highly visible reminder that the page you are viewing is not the latest revision of your topic. It's very simple in TWiki-4 to add a watermark to old revisions as a highly visible reminder, like this:

Whilom ther was dwellynge at oxenford
A riche gnof, that gestes heeld to bord,
And of his craft he was a carpenter.
With hym ther was dwellynge a poure scoler,
Hadde lerned art, but al his fantasye
Was turned for to lerne astrologye,
And koude a certeyn of conclusiouns,
To demen by interrogaciouns,
If that men asked hym in certein houres
Whan that men sholde have droghte or elles shoures,
Or if men asked hym what sholde bifalle
Of every thyng; I may nat rekene hem alle.
-- Main.GeoffreyChaucer - 2 May 1386

TWiki-4 supports something called context ids, one of which, inactive, is set when an old revision is viewed. You can use this context id to control a DIV statement.

In your view.tmpl for your skin (for example, view.pattern.tmpl), add the following definition (on the first line is fine)

%TMPL:DEF{"watermark"}%style="background:url(%PUBURLPATH%/Custom/Customisations/Watermark.gif)"%TMPL:END%
where %PUBURLPATH%/Custom/Customisations/Watermark.gif is the URL of your watermark image. You can use the image attached to this topic as an example.

Now find %TEXT% in the same file. Put a DIV around it, as follows:

<div %TMPL:P{context="inactive" then="watermark"}%> %TEXT% </div>

That will add the watermark on any inactive page, such as when an earlier rev is viewed.

For more on context id's, see TWiki.TWikiTemplates and TWiki.TWikiVariables#VarIF in your installation documentation.

-- Contributors: CrawfordCurrie

Discussion

It appears the sense is wrong on the conditional.

Shouldn't it be written:

<div %TMPL:P{context="inactive" then="watermark"}%> %TEXT% </div>

(ie. When inactive use the watermark for background image)

-- CraigMeyer - 20 Apr 2006

Aha, you found the cunning test I planted to make sure you were paying attention :-/

-- CrawfordCurrie - 20 Apr 2006


CategoryCookbook
Topic attachments
I Attachment History Action Size Date Who Comment
GIFgif old.gif r5 r4 r3 r2 r1 manage 0.3 K 2006-04-20 - 10:01 CrawfordCurrie  
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2006-04-20 - CrawfordCurrie
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.