This question about Configuration: Answered

hide search field in a particular web

Hy,How to hide the search box in a public web. I can do that via the UI or configure?
Either the searchbox should be hidden from the Web or for all public visitors (which must not login).

The reason: it has as yet very few topics, and the visitors would be frustrated when he tried looking for something.

-- KlausMann - 22 Mar 2012

It can not be done via the UI or configure. It requires modifying skin templates so the specifics depend on which skin you are using.

If you are using the default PatternSkin, here's the basic process:
  1. Copy System.WebTopBarExample to System.WebTopBar.
  2. Put STARTINCLUDE and STOPNCLUDE macros around the existing content.
  3. Add a new section below the STOPINCLUDE and move just the search formfrom the main INCLUDE to your new section, so that it looks something like this:
    %STARTSECTION{"searchbox"}%   * <form name="quickSearchForm" action="%SCRIPTURLPATH{view}%/%BASEWEB%/WebSearch"><input type="text" class="foswikiInputField foswikiDefaultText" title="%MAKETEXT{"Search"}%" id="quickSearchBox" name="search" value="%URLPARAM{search}%" size="18" /><input type="hidden" name="scope" value="all" /><input type="hidden" name="web" value="%BASEWEB%" /><noscript>&nbsp;<input type="submit" size="5" class="foswikiButton" name="submit" value="%MAKETEXT{"Search"}%" />&nbsp;</noscript>
  4. In the main INCLUDE, on the line where the search form used to be, add this line:
    %IF{"context authenticated" then="$percentINCLUDE{\"%WEB%.%TOPIC%\" section=\"searchbox\"}$percnt"}%

If you are use the ever-popular NatSkin, here's what you can do:
  1. You're going to be modifying the /templates/topbar.nat.tmpl file. If you have defined a custom skin based on NatSkin, you can simply copy that file to rename it with your local skin name. If not, I'd recommend making a copy of your modified file for future use because the original will be over-written if you update NatSkin. After you've made the changes described below and saved the file, create a copy of it and name it something like topbar.nat.local.
  2. Look for the line that says this:
        <div class="natTopRightContents">%TMPL:P{"searchbox"}%</div>
    and change it to this:
        <div class="natTopRightContents">%TMPL:P{context="authenticated" then="searchbox"}%</div>

-- LynnwoodBrown - 06 Jan 2015


QuestionForm edit

Subject Configuration
Extension NatSkin, PatternSkin
Status Answered
Related Topics
Topic revision: r3 - 06 Jan 2015, LynnwoodBrown - This page was cached on 17 Feb 2019 - 18:45.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy