Customizing Templates

You can extend the capabilities of NetWare Web Search Server by customizing the templates.

The first step is to determine which components of Web Search you want to customize. For example, if you only want to add a few additional search features to the search page template and modify its background color and table size, you would modify the SearchTemplate.html or SearchTemplate.Simple files.

This section discusses how to customize the search, print, and result templates and how to use available parameters and variables to create a customized search solution.


Customizing the Search Templates

You can customize the design and functionality of the static or dynamic search templates by

If you are familiar with HTML, you can quickly modify the design of the default (dynamic) search template or the static search template. For example, you can change the colors of the search page or add new custom graphics.

To modify the functionality of the default search template, you can add or remove search parameters. Search parameters are used to communicate with NetWare Web Search. By embedding them in the correct places in your HTML source, you can extend or limit the functionality of the default search template.

For example, if you wanted your users to use a specific set of templates found in a themes directory, you would add the following HTML code, including the theme parameter, to the SearchTemplate.html file:

<INPUT TYPE="Hidden" NAME="theme" VALUE="$$QueryTemplateTheme">

This sample HTML code tells Web Search to look for templates only in the specified template directory. All themes are located within the templates directory specified in Web Search Manager.

For a complete list of available search parameters, see Table 16, Search Parameters.


Customizing Search Result Templates

NetWare Web Search Server includes several default search result templates that are used to display hits, provide feedback to a user, or request information from a user after a search is performed. For more information about the default search result templates, see Understanding Templates.

You can customize the design and functionality of the default search result template, the template used when a user selects Normal from the Result List Format drop-down list in the NetWare Web Search form. For information about how to access the NetWare Web Search form, see Taking a Test Run.

Customizing the default search result template involves

If you are familiar with HTML, you can quickly modify the design of the default search result template. For example, you can change the colors of the search page or add new graphics.

To modify the functionality of the default search result template, you can add or remove search result variables. Search result variables are placed in the template where you want search results to be displayed.

For example, if you wanted to display the total number of hits returned when a user performs a search and you wanted the information to appear in the upper-left corner of the search results page, you would add the following HTML code to the search result template file:

Total Search Results: $$TotalHits 

After a user performs a search, the $$TotalHits variable would be replaced by the actual total number of hits found during the search.

The $$TotalHits variable is used to retrieve the total number of hits found during a search. You can place this variable anywhere in the results list template to organize the display of information in the way you want.

Default search result templates are located in volume:\searchroot\TEMPLATES\. For a complete list of search result variables that you can use to customize default search result templates or to create new ones, see Table 12, Search Result Variables.


Customizing Print Result Templates

NetWare Web Search Server includes two default print result templates: the default print result template and a "no hits" template. Print result templates are used to organize and format search results for printing and to provide feedback to a user when no hits are found. For more information about the default print result templates, see Understanding Templates.

You can customize the design and functionality of the default print result template in the same way you customize the search result template by

If you are familiar with HTML, you can quickly modify the design of the default print result template. For example, you can change the colors of the print results page or add new graphics to it.

To modify the functionality of the default print results template, you can add or remove print result variables. Variables are placed in the template where you want search results to be displayed.

For example, if you wanted to remove the table of contents from the default print results template, you would remove, or comment out, the following HTML code in the PRINTRESULTLIST.HTML template, which would include the $$BeginTOCList variable:

<CENTER><H2>Table of Contents</H2></CENTER><p><!-- TABLE OF CONTENTS -->$$BeginTOCList[<BIG><B>$$Product</B></BIG><DL>]<DT><A HREF="#$$Bookmark"><BIG>$$Title</BIG></A><SPACER TYPE=HORIZONTAL SIZE=20><I><SMALL>[$$URL]</SMALL></I>$$EndTOCList[</DL>]

You could either save your changes in the default print result list template or you could save it using a new name, thereby creating an alternative template for users who don't want a table of contents in the print results. To be effective, you would then have to add a hypertext link in the search result template that would include the &template=new_template_name query parameter.

Default print result templates can be found at volume:\searchroot\TEMPLATES. For a complete list of print result variables that you can use to customize default search result templates or to create new ones, see Table 13, Print Result Variables.


Customizing Error and Response Message Templates

Error and response messages are used to either provide feedback to the user or to request information from the user.

Error and response message templates are used to display the content of error and response messages sent by the Web Search Server in response to search or print errors. Similar to search and print templates, error and response templates can be customized. However, because the contents of error and response messages are built into NetWare Web Search Server, you cannot modify the contents of the messages or the button objects that might appear, depending on the type of response being generated.


Customizing Error Messages

There are several error messages that can be returned to a user. For example, when users incorrectly use a search operator in a search form, they might get the message, "Search Error: Incorrect use of Boolean operator." An error number might also appear.

While you can utilize HTML tags to format an error message, add or remove variables to determine what information is shown to the user, or even reorganize where the messages will appear in the template, you cannot modify the message itself.


Customizing Response Messages

The same concepts apply to response messages, but response messages return buttons that a user can click. Which buttons appear are determined by the NetWare Web Search Server. While you can modify the labels of these buttons, you cannot determine which buttons will appear, or when.


Testing Your Search and Print Solution

Once you've completed customizing the templates and the search form, you can test them in your Web browser by pointing to the search form URL and entering a search string. See Taking a Test Run for information about how to access the NetWare Web Search form.

HINT:  Remember that a search cannot be performed until you have defined at least one index and generated it using NetWare Web Search Manager. Refer to Web Search Manger's online Help for the steps required in defining and generating an index. Also, see Introducing NetWare Web Search Server for an overview of indexes.



Previous | Next