Tags:
create new tag
view all tags

Question

Is it possible to hide forms on a per topic basis? I'm using them a lot for classification and often the info in them is either redundant or unnecessary to the topic view.

Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Forms

-- CarlMcKinney - 18 Sep 2006

Answer

This can be done using the USERSTYLEURL variable - see TWiki.PatternSkinCssCookbook in your distribution. The form element is wrapped in div twikiForm, so to hide it write in your custom style url:

.twikiForm {display:none;}

-- ArthurClemens - 26 Dec 2006

You can do that also with a specific VIEW_TEMPLATE. See docs at TWikiTemplates; see example user home topic with custom view template, FranzJosefSilli, and view template it points to, PatternSkinUserViewTemplate.

-- PeterThoeny - 28 Dec 2006

Thanks! I prefer the CSS method. Just a note though, for future reference: to hide the forms only in view, so they still show up edit, include in your style sheet:

.patternContent .twikiForm {display:none;}
Assuming you're using PatternSkin...

-- CarlMcKinney - 30 Dec 2006

I've been trying to figure out how to do the CSS flavored way and so Carl, you rule. Was easy to hide the forms everywhere... but not so easy to only do it in VIEW.

Concerning Peter's comment, using a specific VIEW_TEMPLATE works well for some of the stuff I'm doing, but what's the "right" way to add style information into a view template?

I was being dumb re what was USERSTYLEURL .. but then I realized it's in TWiki.TWikiPreferences

-- MatthewKoundakjian - 10 Oct 2007

Thanks for your comments on that topic. I tried the way with the VIEW_TEMPLATE. A detailed description can be found on PatternSkinCustomization

The code of my VIEW_TEMPLATE to hide the form is:

%TMPL:INCLUDE{"view"}%

%TMPL:DEF{"formattop"}%%TMPL:END% %TMPL:DEF{"formatbottom"}%%TMPL:END%

-- PeterSykora - 23 Oct 2007

Closing this question, it seems to be answered.

-- PeterThoeny - 03 Dec 2007

In TWiki 4.2, I would recommend against modifying .twikiForm (like I did frown ) because that class is shared with the attachment table, and you might not want to hide that.

So I modified the view template instead:

  • File: /TWiki/templates/view.pattern.tmpl
  • From: %TMPL:DEF{"formatbottom"}%%TMPL:P{"form"}%%TMPL:END%
  • To: %TMPL:DEF{"formatbottom"}%%TMPL:END%

-- SeanCMorgan - 27 May 2008

You can also conceivably do some XHTML foo like adding the following at the top of your template source:

<style type="text/css">
div.twikiForm {display: none;}
</style>

-- AndyWalker - 07 Oct 2008

Your topic template source, that is...

-- AndyWalker - 07 Oct 2008

Change status to:
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2008-10-07 - AndyWalker
 
  • 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-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.