view
template. For pattern skin this file is /templates/view.pattern.tmpl
.
We describe two approaches to override this template: templates
directory
The quickest way to change the view template would be to simply change the text in the template. A safer way - strongly recommended, because it will survive a Foswiki update - is to create your own custom skin. That may sound like an awful lot of work, but in reality a skin may be as much as 1 file that consists of only a few lines of code.
Example%TMPL:DEF{"topicactionbuttons"}%
, which is located in view.pattern.tmpl
.
The steps you would need: myskin
for now.
/templates
called view.myskin.tmpl
.
view.myskin.tmpl
you write: %TMPL:INCLUDE{"view"}% %TMPL:DEF{"topicactionbuttons"}%%TMPL:P{"more_link"}%%TMPL:END%
?cover=myskin
. You should see an effect now.
* Set COVER = myskinor write
* Set SKIN = myskin,pattern
?cover=myskin
to the url.
ViewTemplate
, for instance BlogPostViewTemplate
.
Call this template by setting VIEW_TEMPLATE
:
* Set VIEW_TEMPLATE = BlogPostView
Template
extension now
OnlyMoreView
, write:
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"more_link"}%%TMPL:END% %TMPL:DEF{"topicactionbuttons"}%%TMPL:P{"more_link"}%%TMPL:END%You can also test this by appending
?template=OnlyMoreView
to the url.
view
script invokes the view
template: (Note that to simplify customization of the top and side bar layouts, the templates include an "Example" topic if the corresponding topic does not exist. Copy the example topic rather than changing the example directly.)
view foswiki css viewtopbar %SYSTEMWEB%.WebTopBar or %SYSTEMWEB%.WebTopBarExample viewsidebar %WEB%.WebLeftBar or %SYSTEMWEB%.WebLeftBarExample viewtopicactionbuttons viewbottombar %SYSTEMWEB%.WebBottomBar or %SYSTEMWEB%.WebBottomBarExampleNote that
WebTopBar
is not used per web, but it's either pulled from WebTopBar, or, if it doesn't exist, from WebTopBarExample.
logo.gif
that is attached to each web's WebPreferences. * Set WEBLOGONAME = logo.gif * Set WEBLOGOIMG = %PUBURLPATH%/%BASEWEB%/%WEBPREFSTOPIC%/%WEBLOGONAME% * Set WEBLOGOURL = %SCRIPTURLPATH{"view"}%/%BASEWEB%/%HOMETOPIC% * Set WEBLOGOALT = Home
There are 2 ways to change the logo in a web:
Using logo.gif:logo.gif
and attach it to the web's WebPreferences topic. PatternSkin's stylesheet assumes the logo is 40px high. More about that later.
/pub/YourWeb/WebPreferences/
(if permitted by your server configuration).
* Set WEBLOGONAME = your-logo-name.gif-or-png
WIKILOGOIMG
, WIKILOGOURL
and WIKILOGOALT
.
To change only the web logo image to site-wide, in SitePreferences set:
* Set WEBLOGOIMG = %WIKILOGOIMG%
More topic actions
link to copy it to WebTopBar. Note that although the name suggest
that this is "per web", the WebTopBar is a site-wide setting.
Change the table style in topic WebTopBar. The default top padding is 11px.
<input type="hidden" name="web" value="%BASEWEB%" />To search all webs, write:
<input type="hidden" name="web" value="all" />To search a couple of webs, for instance the webs Main and System, write:
<input type="hidden" name="web" value="Main,System" />See also: Search macro
WEBHEADERART
, defined in DefaultPreferences.
Redefine your custom preference settings in SitePreferences (to keep DefaultPreferences intact):
* Set WEBHEADERART = %PUBURLPATH%/%SYSTEMWEB%/PatternSkin/Foswiki_header.gif * Set WEBHEADERBGCOLOR = somehexcolor (no quotes, for example: #ffffff)You can also set
WEBHEADERART
per web, by setting the preference in the Web's WebPreferences.
Note: For more precise control, the top bar can be controlled using CSS, however: If WEBHEADERART defaults, or is set to anything other than the empty string, the CSS for the #foswikiTopBarContents
is expanded inline from templates/css.pattern.tmpl
. Overrides using css files will not be possible.
WEBHEADERBGCOLOR
in SitePreferences (to keep DefaultPreferences intact):
* Set WEBHEADERBGCOLOR = %WEBBGCOLOR%
If you have localization enabled, you will also see a language dropdown box at the far right.
You can remove these items from WebTopBar.
The view template is populated with page elements using template inclusions:
%TMPL:INCLUDE{"view"}% %TMPL:INCLUDE{"viewtopicactionbuttons"}% %TMPL:INCLUDE{"viewtopbar"}% %TMPL:INCLUDE{"viewsidebar"}%Each included template draws a part of the screen.
%TMPL:INCLUDE{"viewtopbar"}%
to hide the top bar.
Another approach is to clear the contents of module topbar
with an empty definition. Using either a template or a topic template, write in your custom template:
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"topbar"}%%TMPL:END%
and add:
%TMPL:DEF{"topbardimensions"}%#patternTopBar, #patternClearHeaderCenter, #patternClearHeaderLeft, #patternClearHeaderRight { height:0px; }%TMPL:END%Using style sheets:
%TMPL:INCLUDE{"viewsidebar"}%
to hide the side bar, or in a custom template clear it using
%TMPL:DEF{"sidebar"}%%TMPL:END%Using style sheets:
It may defy the wiki-ness of your Foswiki installation, but in certain circumstances it could be useful to hide the edit buttons from users that are not logged in, for instance for clients that have gotten viewing rights only.
Using either a template or a topic template, 'empty'top:toolbarbuttons
and topicaction
by writing:
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"top:toolbarbuttons"}%%TMPL:END% %TMPL:DEF{"topicaction"}%%TMPL:END%In the user page of WikiGuest, set the cover to
* Set COVER = customer
By default this topic is editable only by Wiki admins.
viewtopicactionbuttons.tmpl
. The bottom history link is defined in DEF action_revisions
%TMPL:DEF{"topicactionbuttons"}% %TMPL:P{"action_activatable_edit_or_create"}% %TMPL:P{"action_activatable_attach"}% %TMPL:P{"action_printable"}% %TMPL:P{"action_revisions"}% %TMPL:P{"action_backlinks_simple"}% %TMPL:P{"action_raw_or_view"}% %TMPL:P{"action_activatable_raw_edit"}% %TMPL:P{"activatable_more"}% %TMPL:END%To hide that link, In a custom skin view template
view.myskin.tmpl
empty action_revisions
by replacing it with an empty string:
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"action_revisions"}%%TMPL:END%
view.pattern.tmpl
is:
%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"activatable_edit_or_create"}%%TMPL:P{"activatable_attach"}%%TMPL:END%Create a new skin by creating a file
view.myskin.tmpl
in the templates
directory. Write in it:
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"history_history_link"}%%TMPL:END%View any topic with
?skin=myskin,pattern
, or set the SKIN
preference to myskin,pattern
.
This will remove the Edit and Attach buttons, and place a History button at the top.
You will probably not just want to have the History button there. Other button include names are:create_topic_link raw_edit_link view_topic_link activatable_attach activatable_edit_or_create more_link activatable_printable backlinks_web_link backlinks_all_link backlinks_link history_rdiff_link history_history_link raw_link
contentheader
and contentfooter
, both defined in view.pattern.tmpl
. These containers can contain text or html and are placed directly before and after the topic text.
Both modules are wrapped in CSS containers: contentheader
- wrapped in div
of class foswikiContentHeader
. Expands beforetext
template.
contentfooter
- wrapped in div
of class foswikiContentFooter
. Expands aftertext
template.
contentheader
and contentfooter
templates are
PatternSkin specific names for the beforetext
and aftertext
templates. For best
compatibility with other skins, you should override beforetext
, and/or aftertext
.
To put contents before the main text, use the custom skin approach as described above.%TMPL:INCLUDE{"view"}% %TMPL:DEF{"beforetext"}%This is the text before%TMPL:END%Use the same procedure for contents to be put after the topic text:
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"aftertext"}%This is the text after%TMPL:END%
TMPL:PREV
option
to expand the previous definition of the template.
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"beforetext"}%This text prefaces other aftertext templates.%TMPL:PREV%%TMPL:END% %TMPL:DEF{"aftertext"}%%TMPL:PREV%This text extends other aftertext templates.%TMPL:END%
formtop
(form at the top) and formbottom
(form at the bottom). The default definition is:
%TMPL:DEF{"formtop"}%%TMPL:END% %TMPL:DEF{"formbottom"}%%TMPL:P{"form"}%%TMPL:END%
You simply swap the bucket contents. Using either a template or a topic template, write in your custom template:
%TMPL:INCLUDE{"view"}% %TMPL:DEF{"formtop"}%%TMPL:P{"form"}%%TMPL:END% %TMPL:DEF{"formbottom"}%%TMPL:END%