This example shows the basic process of creating and implementing an alternate control for the search box that is displayed on site pages. The alternate control specifies a different image file to use next to the box.

  1. Create a folder in Local_Drive:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/FEATURES called NewSearchBox by copying the default \TEMPLATE\FEATURES\ContentLightup folder

        
  2. In the NewSearchBox folder, modify the existing Feature.xml file, generating a new GUID by running guidgen.exe located in Local_Drive:\Program Files\Microsoft Visual Studio 8\Common7\Tools.

  3. In the Controls subfolder included in the first step, modify the searcharea.xml file so that it references an alternate .ascx file such as the following.

        
  4. In \TEMPLATE\CONTROLTEMPLATES, copy the SearchArea.ascx file , and then rename this copied file mySearchArea.ascx.

  5. On the <img> tag located near the end of your copied .ascx file, modify the value of the src attribute to point to an alternate image file. For testing purposes, you can use one of the default image files installed in \TEMPLATE\IMAGES, such as in the following example, which simply replaces gosearch.gif with FOLDER.GIF.

        
  6. At a command prompt, type the following commands to install the feature in the deployment and activate the Feature on a specified subsite.

       a. stsadm -o installfeature -filename NewSearchBox\feature.xml
        b. stsadm -o activatefeature -filename NewSearchBox\feature.xml -url http://Server/Site/Subsite
  7. Navigate to the home page of the specified subsite to see the changes made to the search box.

相关文章: