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:
- Copy System.WebTopBarExample to System.WebTopBar.
- Put STARTINCLUDE and STOPNCLUDE macros around the existing content.
- 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> <input type="submit" size="5" class="foswikiButton" name="submit" value="%MAKETEXT{"Search"}%" /> </noscript>
</form>%ENDSECTION{"searchbox"}%
- 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:
- 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
.
- 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