Customising the Search Box in a SharePoint 2007 publishing site

I recently had a requirement to customise the default search box(es) on a SharePoint publishing site.

The requirements were:
1. Customise the search buttton.
2. Hide the advanced search link.
3. Hide the search scope dropdown.
4. Default to a specific search scope.
Solutions.
1. Customise search button and 2. Hide advanced
Implement a feature that configures the search box parameters. Here is the content of the feature’s elements.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control
   Id="SmallSearchInputBox"
   Sequence="25"
   ControlClass="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx"
   ControlAssembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
    <Property Name="SearchResultPageURL">/search/results.aspx</Property>
    <Property Name="FrameType">None</Property>
    <Property Name="DropDownMode">ShowDD_NoContextual</Property>
    <Property Name="TextBoxWidth">140</Property>
    <Property Name="ShowAdvancedSearch">false</Property>
    <Property Name="GoImageUrl">/Images/go.jpg</Property>
    <Property Name="GoImageActiveUrl">/Images/go.jpg</Property>
  </Control>
</Elements>
3. Hide scope
While it is possible to configure the search box parameters with the scope dropdown as hidden this has the effect that the search scope reverts to the All Sites scope regardless of any site scope settings. Therefore the following CSS was used:
     TD.ms-sbscopes{
      visibility:hidden;  
     }

4. Default to a specific scope.
Site collection settings configured with only the specific scope as an available scope.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s