You are here: CFCL Wiki>Help Web>WikiTut>WikiTutTemplateView (09 Feb 2011, vlb)Edit Attach

Wiki Tutorial: Set VIEW_TEMPLATE

Wiki uses server-side templates to determine how to render all pages displayed in a Wiki site. It is possible to override the settings for the View and Edit functions
  • for the site
  • for a web
  • for an individual user
  • for a single topic.

Note that these are not the same as the template topics used by Wiki applications. (Same word; different meaning.)

Two preference variables can be used to override the templates used:

  • VIEW_TEMPLATE sets the template to be used when viewing a topic.
  • EDIT_TEMPLATE sets the template to be used when editing a topic.

If these preferences are set for a topic, a web (in WebPreferences), or in your Main.WikiGuest topic, the specified templates will be chosen for view or edit respectively.

To avoid the need to copy the complete contents of the default template, TMPL:INCLUDE can be used for "piecewise customisation". For example, to create a customisation of pattern skin, where you only want to over-ride the breadcrumbs for the view script, you can create only a customized view template as

%TMPL:INCLUDE{"view"}%
%TMPL:DEF{"breadcrumb"}% We don't want any crumbs %TMPL:END%

Put this text into a topic, e.g. MyWeb.NoBreadcrumbsViewTemplate and then

   * Local VIEW_TEMPLATE = MyWeb.NoBreadcrumbsViewTemplate

Important: Be sure to specify the name of the web, as well as the topic, in the Setting. Spell it out (don't use %WEB%.)

Note: In Wiki version 4.1 and later, you need to set these preferences locally (using Local instead of Set).

How Do I...

Override the Web Left Bar

Groups can customize the left side bar for the entire web by editing the WebLeftBar topic. Individuals are encouraged to create a "personal sidebar" topic; the contents is added to the left bar when that person is logged into Wiki.

However, what if an individual wants to override the entire left side bar? Here's how one person put it:

I know this side bar is useful, but I haven't clicked on any of those useful links for a long time. How do I override the WebLeftBar topic with my own personal customized version?

See WikiTutTricksWebLeftBar.

Override the Web Top Bar

In the past, groups could customize the top bar for an entire web by simply editing the WebTopBar topic. In Wiki 4.x, this is no longer as easily accomplished.

Thanks to an update to our default templates, it is possible to (once again) customize the top bar for a Wiki web by simply editing the WebTopBar topic to taste. There's one small problem with that approach, however. The default vertical space may be shorter than your customization.

In that case, you have two choices:
  1. Change the hight of your top bar contents
  2. Create a custom VIEW_TEMPLATE for your web.

See WikiTutTricksWebTopBar.

Mark Recently Edited Pages

The revision info in the upper right of a page tells when the page was last edited.
  • screenshot:
    screenshot

But it's printed in light gray and you need to read it and calculate how long ago that was.

It would be nice if a recently updated page could be marked as having been recently updated, e.g.
  • screenshot:
    screenshot

See WikiTutTricksRecentUpdate.


-- VickiBrown - 11 Sep 2008

Topic revision: r6 - 09 Feb 2011, vlb
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email