FindinSite-MS: Search engine for an ASP.NET website   .
  search
Powered by FindinSite-MS
. Home | Installation | Indexing | Control Panel | Web services | Advanced | Purchasing .
. .
  Web.Config options | Look and Feel | Languages | Word highlighting | Runtime parameters | Rules | Subsets | Meta-data fields

 

findinsite-ms Look and Feel


This page describes how to customise the look and feel of the findinsite-ms web pages:
  • Template files customise all the basic HTML for returned pages, with template variables updated depending on the results
  • The language support can be changed or enhanced.
  • The results can be reordered in various ways.
  • If you want word counts on each hit page, you have to enable this.
  • Alter the hits per results page from the default of 10.

These facilities are aimed at web site designers. For ultimate control, use the programmer interface Search API XML Web Service to retrieve the results and process as you wish.

Character Sets:
It is very important that the page header (and other template files) use the %META_CHARSET% variable to specify the page charset. If this is not set then findinsite-ms may interpret typed characters incorrectly. Currently findinsite-ms always uses "UTF-8" for %META_CHARSET%, so your templates should be encoded using the UTF-8 charset.

Here is a full list of the available options:

  Supplied file Description
Initial search page search.aspx This is the findinsite-ms localised search page for you. See below.
Page header findhead.htt See below for more details.

These template files can also include other pages, including ASPX pages that are sent findinsite-ms variables as form parameters.

Results top findtop.htt
Results line detail findline.htt
Results bottom findbot.htt
Page footer findfoot.htt
Error display finderror.htt
Languages   Languages can be added or altered - see the languages page.
Get word count   If you want word counts on each hit page, you have to enable this - see the look and feel page.
Results order   The results can be reordered in various ways - see the look and feel page.
Pages per results sheet   Alter the ResultsPerSheet form runtime parameter in a search page if you do not wish to use the default of 10 pages per results sheet.

Calling findinsite-ms

  • You will usually add a small search form to each web page of your web site - see the calling findinsite-ms page for details.

  • You can use the findinsite-ms localised search page as your Advanced search page if you want.  The URL for this page varies from case to case, but might be http://localhost/findinsite/search.aspx

    The look and feel of this search page can be changed using configurable template files as described below.


Template files

These configurable template files determine the appearance of the pages produced by findinsite-ms, as follows:

Control Panel box Init parameter Description
Heading file heading The heading at the top of every findinsite-ms page
Top file top The extra heading at the top of search results
Line file line Each findinsite-ms results line
Bottom file bot The extra footer at the bottom of search results
Footer file footer The footer at the bottom of every findinsite-ms page
The Free version always inserts an additional findinsite-ms footer.
Error display error The information that is displayed when no results are found or when an error situation occurs

findinsite-ms gets the name of each file from the values set in the Control Panel Look and Feel section.  However, if any file is not available then findinsite-ms supplies a basic default value.

Each template file can contain any HTML.  However, each file is a template, so any instance of a findinsite-ms variable is replaced with a suitable value at runtime.  The heading and footer template files may contain Heading and Footer Variables.  The top and bottom template files may contain Top and Bottom Variables.  The results line template file should contain Result Line Variables. The error display template file should contain Error Display Variables.

Each template file may use %INCLUDE=...% directives to include other pages in the output, as described below. The included pages may be static files or dynamically generated. An included dynamic page (eg ASPX) is sent various findinsite-ms form variables.


CSS Styles

Although the findinsite-ms output is easily customised, various details are hard-coded. To let you alter these, findinsite-ms uses various preset stylesheet styles. The supplied default heading template includes inline definitions for these standard styles.

For example, if a template uses the %SEARCH_TEXT% variable then HTML like the following is generated:
<SPAN CLASS=fisSearchText>xxx</SPAN>
where xxx is the entered search text. The style fisSearchText is hard-wired into findinsite-ms. The default header template defines fisSearchText as follows:

<STYLE TYPE="text/css">
.fisSearchText { background: pink; font-family:monospace; }
</STYLE>

findinsite-ms uses several such styles, but the header template does not define styles for all of them, so no styling is used.

The styles that are used are listed in each section below.


Heading and Footer Variables

Heading and Footer variables are replaced at runtime by findinsite-ms in the heading and footer template files.

As well as ordinary HTML (of any sort), findinsite-ms replaces any instances of the following variable names with the described text.  If the description says that the text is localised then the text is taken from the language file for the user's preferred language.  See the findhead.htt and findfoot.htt files in the findinsite-ms work directory for examples of these variables in use.

Parameter
name
Description Style Example
%APPNAME% The findinsite-ms application name   findinsite-ms
%CONTAINS% The total number of pages and words in all the search database subsets
Localised
  7 pages and 1327 words
%COPYRIGHT% The findinsite-ms copyright message   Copyright © 1998-2011 PHD Computer Consultants Ltd
%DB_CREATION_DATE% The first subset search database creation date   14/12/2004
%DB_DESCRIPTION% The first subset search database description   findinsite-ms: Site Search engine
%DB_FILENAME% The filenames of all the search database subsets   index1
%INCLUDE=..% Includes another page in the output - see below   %INCLUDE=head.aspx%
%INDEX_DESCRIPTION% The index description, set in the Searching section of the Control Panel  
%INSTRUCTIONS% Localised basic instructions for using findinsite-ms  
%L_APPNAME_SERVER% Localised description for findinsite-ms   findinsite-ms Site Search Tool
%L_CONTAINS% Localised phrase for Contains   Contains
%L_INDEX% Localised phrase for Index   Index
%L_LANGUAGE% Localised phrase for Language   Language
%L_SEARCH% Localised phrase for Search   Search
%L_SEARCH_FOR% Localised phrase for Search for:   Search for:
%L_SITE% Localised phrase for Site:    Site: 
%LANGUAGE_NAME% The localised name of the language file for the current user   Deutsch (German)
%LANGUAGES% A list of links to set the user interface language used by findinsite-ms  
%META_CHARSET% The charset used by findinsite-ms to encode its output characters   UTF-8
%PAGES% The total number of pages in all the search database subsets   7
%SEARCH_TEXT% The last search entered fisSearchText CD and Search
%FIELDS_TEXT% The last field search terms entered fisFieldsText [keywords:search] [lang:en]
%DYNAMIC_DB% A copy of the passed "db" parameter   http://www.phdcc.com/fiscd/fiscddb
%SERVER% The server details   .NET v1.1.4322
%SITES% List of links to sites currently being searched fisSite <A HREF=http://www.phdcc.com/ CLASS=fisSite>www.phdcc.com</A>
%SUPPORTEMAIL% The PHDCC support email address   support@phdcc.com
%THIS_URL% The URL to get back to findinsite-ms with no GET query appended   http://www.phdcc.com/findinsite/search.aspx
%VERSION% The findinsite-ms version number   1.19.2351.12938
%VERSION_DATE% The findinsite-ms version date   8 Jun 2006
%WORDS% The total number of different words in all the search database subsets   1327


Top and Bottom Results Variables

Top and Bottom variables are replaced at runtime by findinsite-ms in the top and bottom results template files.

As well as ordinary HTML (of any sort), findinsite-ms replaces any instances of the following variable names with the described text.  If the description says that the text is localised then the text is taken from the language file for the user's preferred language.  See the findtop.htt and findbot.htt files in the findinsite-ms work directory for examples of these variables in use.

Parameter
name
Description Style Example
%HITS% The number of hits   15
%INCLUDE=..% Includes another page in the output - see below   %INCLUDE=top.aspx%
%L_FIRST% Localised phrase for First as a link.
Empty if only one sheet
fisFirstLink First
%L_HITS_TEXT% Localised phrase for 1 page found   15 pages found
%L_LAST% Localised phrase for Last as a link.
Empty if only one sheet
fisLastLink Last
%L_NEXT_SHEET% Localised phrase for Next as a link.
Empty if no next sheet
fisNextLink Próximo
%L_PREV_SHEET% Localised phrase for Previous as a link.
Empty if no previous sheet
fisPrevLink Precendente
%L_SEARCH_RESULTS_FOR% Localised phrase for Search results for:   Résultats de la recherche pour:
%L_SEARCH_SUMMARY% Localised results summary   Results 1 - 10 of 114
%L_STOP_WORDS% Localised list of ignored common words in the search text   Ignored common words: the a
%SEARCH_TEXT% The search text fisSearchText brown car
%FIELDS_TEXT% The last field search terms entered fisFieldsText [keywords:search] [lang:en]
%SHEET_DECADE% A set of approx 12 sheet number links near the current sheet fisDecadeNumberLink
fisSheetNumber
9 10 11 12 13 14 15 16 17 18 19 20 21
%SHEET_FIRST% First sheet number as a link.   1
%SHEET_FIRST_DOTS% First sheet number as a link followed by  .. 
Empty if first sheet in %SHEET_DECADE%
fisFirstNumber 1 .. 
%SHEET_LAST% Last sheet number as a link.   1
%SHEET_LAST_DOTS% Last sheet number as a link preceded by  .. 
Empty if last sheet in %SHEET_DECADE%.
fisLastNumber  .. 25
%SHEET_NO% The results sheet number   2
%TIME% The time taken for the request    

The default text for the top template is:

<TABLE WIDTH="100%" cellpadding=0 cellspacing='0'> <tr><td bgcolor="#ffffcc"><img height=1></td></tr> <tr><td bgcolor="#ffffcc"> %L_SEARCH_RESULTS_FOR% %SEARCH_TEXT%%FIELDS_TEXT% %L_STOP_WORDS% &nbsp;&nbsp;%L_SEARCH_SUMMARY% &nbsp;&nbsp; %L_PREV_SHEET% %L_NEXT_SHEET% (%TIME%) </td></tr></table>

The default text for the bottom template is:

<TABLE WIDTH="100%" cellpadding=0 cellspacing='0'> <tr><td bgcolor="#ffffcc"> %L_SEARCH_RESULTS_FOR% <SPAN style='background: pink;'><CODE>%SEARCH_TEXT%%FIELDS_TEXT%</CODE></SPAN> %L_STOP_WORDS% &nbsp;&nbsp;%L_HITS_TEXT%&nbsp;&nbsp; %L_PREV_SHEET% %SHEET_DECADE% %L_NEXT_SHEET% -&nbsp; %L_FIRST% %L_LAST% </td></tr> <tr><td bgcolor="#ffffcc"><img height=3></td></tr> </table>


Result Line Variables

When findinsite-ms lists the hit pages that it has found, it uses the contents of the line file as its display template.  See the file findline.htt in the findinsite-ms work directory for examples of these variables in use.

The line file can contain any HTML.  However, it will mainly contain result variables, described in the list below.

The entire results line has the search words highlighted, using the style hilite.

Tag name Description Style
%ABSTRACT% An abstract for the found file fisAbstract
%ALLTEXT% The entire plain text of the file  
%DATE% The file date  
%FILENAME% The filename of the found file fisFilename
%FILENAME_LINK% The filename of the found file, as an HTML link fisFilenameLink
%INCLUDE=..% Includes another page in the output - see below  
%INDEXED% The date the file was indexed  
%PAGE_WORDCOUNT% The count of words in the found file  
%RESULTNO% The result number fisResultNo
%SHORTURL% The full URL of the found file, truncated to 80 characters if need be fisURL
%SHORTURL:n% The full URL of the found file, truncated to n characters if need be fisURL
%SHORTURL_LINK% The full URL of the found file, truncated to 80 characters if need be, as an HTML link fisURLLink
%SHORTURL_LINK:n% The full URL of the found file, truncated to n characters if need be, as an HTML link fisURLLink
%SIZE% The file size  
%SNIPPET% An extract from the file containing the search words.
The default is to have 40 words total, with a maximum of 10 words before and after a search word, stopping snippets at sentence ends.
 
%TITLE% The title of the found file fisTitle
%TITLE_LINK% The title of the found file, as an HTML link fisTitleLink
%URL% The full URL of the found file fisURL
%URL_LINK% The full URL of the found file, as an HTML link fisURLLink
%WORDCOUNT% The total count of all search words in the found file fisWordcount


Example line template

The default text for the line template is:
<DL><DT>%RESULTNO%. %TITLE_LINK%</DT><DD> <table><tr><td><i>%ABSTRACT%</i></td></tr></table> <table><tr><td>%SNIPPET%</td></tr></table> %SHORTURL_LINK% - %DATE% - %SIZE% - <span class=indexed>indexed:%INDEXED%</span></DD></DL>

Here is an example of what this result will look like, in the middle of a results list:

3. findinsite-ms Control Panel config.htm
How to use the online configuration screen of FindInSite
4. FindInSite rules for Word stemming and Synonyms rules.htm
FindInSite rules for Word stemming and Synonyms


Error Display Variables

If findinsite-ms encounters a problem, it reports this using the contents of the error display file as its template. Possible problems include (a) the user entering no search text, (b) no hits being found, and (c) unexpected program errors.

The error display file can contain any HTML, including the error display variables, described in the list below.

Tag name Description Style Example
%ERROR_TITLE% A header for the report   findinsite-ms Results
%ERROR_MSG% The report message   0 pages found

These words were not found in any pages: sausage

%FIELDS_TEXT% The last field search terms entered fisFieldsText [keywords:search] [lang:en]
%L_SEARCH_RESULTS_FOR% Localised phrase for Search results for:   Résultats de la recherche pour:
%SEARCH_TEXT% The last search entered fisSearchText CD and Search


Template Include Directives

Any of the template files may use a directive %INCLUDE=...% to include another page in the findinsite-ms output. The page name must not be in quotes. The page name is appended to the findinsite-ms application URL, and sent as a web request (not a file access). The page output must be in UTF-8.

Use the following in a findinsite-ms template file (eg findhead.htt) to include the contents of file header.htt in the findinsite-ms output.

%INCLUDE=header.htt%

A template file can refer to an ASPX file if you want, eg:

%INCLUDE=head.aspx%


Include file form variables

Included files are sent findinsite-ms parameters as FORM variables - but only if the included file is an ASPX file. Therefore included files can generate dynamic output based on the current search or search result. (Note that the Session object is not used.)

The following excerpt from an ASP.NET file indicates how the form variables can be used - however see below for details of charset considerations.

SearchText <%=Request.Params["SearchText"]%><br>
SheetNo <%=Request.Params["SheetNo"]%><br>
ResultsPerSheet <%=Request.Params["ResultsPerSheet"]%><br>

The following form variables are available as strings, and valid as indicated. The "SearchText", "Title" and "Abstract" strings are made HTML-safe for printing out in a browser.

Header, Footer, Top, Bottom and Line
SearchText
SheetNo
ResultsPerSheet
Top, Bottom and Line
hits
SHEET_LAST
Line
ResultNo
Title
Filename
URL
Abstract
WordCount


Include file parameter charset considerations

The form variables passed to the include file are encoded in the UTF-8 charset. If the include file is in the findinsite-ms application directory then the form variables are assumed to be in the "ISO-8859-1" charset. This is set in the application Web.Config file - do not change this setting please. Instead use the following C# code to get the form variables correctly.

This complete example lists all supplied form parameters. The getFormParameter() method handles the charset conversion correctly.

<%@ Page Language="c#" AutoEventWireup="true" %>

<script Language="c#" runat=server>
private string getFormParameter( string name)
{
	string rv = Request.Form[name];
	if( rv==null || rv.Length==0) return null;
	byte[] rvb = Request.ContentEncoding.GetBytes(rv);
	char[] rvc = Encoding.UTF8.GetChars(rvb);
	rv = new String(rvc);
	return rv;
}
</script>


All parameters:<br>
<%
foreach( string param in Request.Form)
{
	Response.Write(param+"="+getFormParameter(param)+"<br>");
}
%>

Note: in the above code, ASP.NET performs cross-site scripting validation on all form variables. Some abstracts could cause such a failure.


Change how you look - and feel better
  All site Copyright © 1996-2014 PHD Computer Consultants Ltd, PHDCC   Privacy  

Last modified: 18 July 2007.