There are now some 40+ templates in TWiki. Must of them is in common i.e. the header and parts of the footer.
I've added the template
headerfooter.tmpl so that this commonality can be factored out.
Advantages:
- Templates become simpler and easier to maintain
- A new skin can change the look of all templates by introducing a new
headerfooter
Disadvantages:
- An extra file read for every view - doesn't seem to be an issue
- Makes assumptions about header/footer information
I will make available a new set of refactored templates that can be substitued for the current set, if these are widely liked I hope they can replace the current set.
--
JohnTalintyre - 04 Jul 2001
Not so sure if this is the right approach. The header and footer look similar but have some small differences. How do you handle those? There are not so many basic templates, most are "oops" messages. It might make sense to change the "oops" template system so that we have only one oops
HTML template and many message that fill in the details of the oops template.
--
PeterThoeny - 06 Jul 2001
One can allow for small differences, the question is what differences. At present the following are dealt with in the
headerfooter.tmpl:
- Header
- Different name
- Different description
- Footer
- Different command items at the bottom - arbitary HTML
Note that the header is just body html, it does not represent the
HTML header, but the header on the page.
I've attached the header/footer for the existing TWiki look.
--
JohnTalintyre - 08 Jul 2001
I'm definitely interested in modularising the current templates - I have done quite a few global changes to a number of templates for things such as using style sheets, and more far-reaching changes would be quite painful. Using
perl -pi.bak is very powerful but shouldn't really be necessary.
I think that TWiki's templates do need some enhancement for
BetterSkins in order to address the target user base of corporate intranets. It would also be good to have an alternative logo - the Buck Rogers association with TWiki doesn't exactly send the right message

Of course the logo can be customised by editing templates, but at the least it should be represented by a variable, and ideally replaced with something more neutral.
(Added John's signature above, and I think he meant 'extra file read' so changed that too.)
--
RichardDonkin - 08 Jul 2001
To recap, this header/footer scheme reduces the work involved to synchronize any site with a custom skin to TWiki.org. Up to now, this has meant applying changes to all 48 (yes 48!) tmpl files. Use the header/footer approach and there are just 2 classes of templates to deal with:
- Custom templates that are completely different from the TWiki.org version
- Custom templates that just have different header/footer from the TWiki.org version
- attach.tmpl
- edit.tmpl
- etc, etc
So, now all the differences are encapsulated in just three templates: view.tmpl & preview.tmpl (which need a detailed diff anyhow) and headerfooter.tmpl.
To encourage TWiki.org devotees to take up this new scheme, I have now refactored the entire current template set to use header/footer. The templates are attached
hereto. Please go ahead and use them - I am hoping that there will be a sufficient demand that they will make it to the TWiki core - and save us all the pain of synchronising each individual template
--
SteveRoe - 18 Jul 2001
Different web owners on my corporate TWiki wanted to use different logos in the top-left corner. To this end I changed the header on view.tmpl to use the icon defined by an variable overridden in
WebPreferences. I cheated and got them to point to an attachment on the
WebHome page, e.g.
* Set WIKIHOMEICON = /twiki/pub/Siebel/WebHome/Siebel.gif
The default for this is set in
TWikiPreferences.
I'd appreciate if something like this could become standard. (Simple, but it requires a variable syntax to be able to refer to an attachment on a given page).
Please see
ExtensionToAttachUrlDirective for suggestion.
--
MartinCleaver - 18 Jul 2001
Agreed about the home icon variable - I had to do a global edit just to change this.
Also, we should really think about having a standard icon that is not the Buck Rogers' TWiki character - since TWiki is aiming at the corporate market, it would be best not to have something from a science fiction TV show as the logo
--
RichardDonkin - 19 Jul 2001
I tried using these on my home installation of the 20010315 beta. I don't really know what I'm doing, but it does not appear to work. Should it work with the 20010315 beta?
What I did:
Downloaded the zip file, emptied my templates directory, unzipped these into my templates directory, and restored my view and preview templates. Then I took the header from my view template and cut and pasted it to the headerfooter template in place of everything before the first %SPLIT%. (I don't really have a clue.) What should I have done?
--
RandyKramer - 20 Jul 2001
Rany, this does not work because the heder&footer specific code is not in the 15 Mar 2001 Beta.
Header and footer are common but here are some subtile differences. I investigating the templates that have a header of some kind of difference, and sorted by difference:
| Template: |
Diff of header to view: |
Comment: |
| |
|
|
| view.tmpl |
|
Has everything; TWiki . Web . Topic is linked |
| rdiff.tmpl |
Like view |
|
| changes.tmpl |
Like view, but Changes instead of %TOPIC% |
|
| 3 * search*.tmpl |
Like view, but SearchResult instead of %TOPIC% |
|
| |
|
|
| edit.tmpl |
No links |
Navigation reduced |
| preview.tmpl |
No links, but help |
Navigation reduced |
| attach.tmpl |
Like edit.tmpl |
Navigation reduced |
| rename.tmpl |
No links; empty web topic list; %OLD_WEB% instead of %WEB% |
Navigation reduced |
| moveattachment.tmpl |
Like rename.tmpl |
Navigation reduced |
| |
|
|
| 27 * oops*.tmpl |
No links |
Navigation reduced |
| noweb.tmpl |
Like oops.tmpl |
Should be an oops message |
| changeform.tmpl |
No links |
Could be an oops message ? |
Looking at this we have these types of templates in regards to the header:
-
6 * view: Full navigation
-
5 * edit: Reduced navigation
-
29 * oops: Reduced navigation, similar to edit
So it should be possible to find a common pattern. The oops dialogs (actually not dialogs, but I call them so because they have this functionality) are all identical with some variable parts like heading, main text and so on.
John's experimental header&footer code is a good start. I decided to go beyond that with a more flexible
TWikiTemplatingSystem that can be enhanced over time. John, I replaced your experimental code, hope this is OK.
--
PeterThoeny - 21 Jul 2001
Peter.
Thanks for the reply! I'll go look at
TWikiTemplatingSystem and then probably wait until I update my TWikis. The additional information you provide in the table should be very helpful.
--
RandyKramer - 21 Jul 2001