Summary: hide the search bar at the top of a skin with (:nosearch:)
Version: 2009-10-15
Prerequisites: none
Status:
Maintainer:
Questions answered by this recipe
How can I hide the search-bar at the top of the screen on some pages?
Description
Skins like the default PmWiki-skin provide a handy search-bar at the top right of the screen. Currently, if one wanted to hide the search-bar on certain pages, it wouldn't be possible to do this without hiding the entire titlebar with (:noheader:) - which hides the logo and a considerable amount of "buffer" space.
In order to only hide the search-bar, a couple modifications must be made.
1. Adding a PageSearchFmt Page Section
In pmwiki.tmpl (or whichever Skin you're using), you'll need to enclose your search-bar code in it's own Page Section, which we'll call PageSearchFmt:
<!--PageSearchFmt-->
<div id='wikihead'>
<form action='{$ScriptUrl}'>
<span class='headnav'><a href='{$ScriptUrl}/$[{$Group}/RecentChanges]'
accesskey='$[ak_recentchanges]'>$[Recent Changes]</a> -</span>
<input type='hidden' name='n' value='{$FullName}' />
<input type='hidden' name='action' value='search' />
<a href='{$ScriptUrl}/$[{$SiteGroup}/Search]'>$[Search]</a>:
<input type='text' name='q' value='' class='inputbox searchbox' />
<input type='submit' class='inputbutton searchbutton'
value='$[Go]' /></form></div>
<!--/PageSearchFmt-->
2. Adding the (:nosearch:) PageDirective
Final step is to declare the (:nosearch:) page-directive via the following code in config.php:
Markup('nosearch', 'directives',
'/\\(:nosearch:\\)/ei',
"SetTmplDisplay('PageSearchFmt',0)");
Adding (:nosearch:) to a page will now hide the search bar, but will leave the rest of the header intact.
Notes
Release notes
- 2009-10-15 - initial release
See also
Contributors
Comments
This space is for User-contributed commentary and notes.
Please include your name and a date (eg 2007-05-19) along with your comment.
Optional alternative: create a new page with a name like "ThisRecipe-Talk" (e.g. PmCalendar-Talk).
User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.