Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > bebff3570faee357416d2588192a229a > files > 167

mnogosearch-3.2.8-1mdk.ppc.rpm

<HTML
><HEAD
><TITLE
>Designing search.html</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.73
"><LINK
REL="HOME"
TITLE="mnoGoSearch 3.2 reference manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Searching documents"
HREF="msearch-doingsearch.html"><LINK
REL="PREVIOUS"
TITLE="How to write search result templates

"
HREF="msearch-templates.html"><LINK
REL="NEXT"
TITLE="Relevancy

"
HREF="msearch-rel.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="mnogo.css"><META
NAME="Description"
CONTENT="mnoGoSearch - Full Featured Web site Open Source Search Engine Software over the Internet and Intranet Web Sites Based on SQL Database. It is a Free search software covered by GNU license."><META
NAME="Keywords"
CONTENT="shareware, freeware, download, internet, unix, utilities, search engine, text retrieval, knowledge retrieval, text search, information retrieval, database search, mining, intranet, webserver, index, spider, filesearch, meta, free, open source, full-text, udmsearch, website, find, opensource, search, searching, software, udmsearch, engine, indexing, system, web, ftp, http, cgi, php, SQL, MySQL, database, php3, FreeBSD, Linux, Unix, mnoGoSearch, MacOS X, Mac OS X, Windows, 2000, NT, 95, 98, GNU, GPL, url, grabbing"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#EEEEEE"
TEXT="#000000"
LINK="#000080"
VLINK="#800080"
ALINK="#FF0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>mnoGoSearch 3.2 reference manual: Full-featured search engine software</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="msearch-templates.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 8. Searching documents</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="msearch-rel.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="html"
>Designing search.html</A
></H1
><P
>This section is assuming that you are using the CGI front end.</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="html-respage"
>How the results page is created</A
></H2
><P
>The file <TT
CLASS="filename"
>etc/search.htm</TT
>
consists of a number of blocks delimited by HTML comments that start
with &#60;!--comment--&#62; and end with &#60;!--/comment--&#62;.</P
><P
>The &#60;!--variables--&#62; block is only used by
<TT
CLASS="filename"
>search.cgi</TT
>. The other blocks form part of the
results output depending on the situation. </P
><P
>The blocks &#60;--top--&#62; and
&#60;!--bottom--&#62; are always returned to the user as the top and
bottom part of the output respectively. </P
><P
>There are three series of &#60;!--restop--&#62;,
&#60;!--res--&#62; and &#60;!--resbot--&#62; blocks. The first series is
returned to users that have requested long results (default), the
second one to those that have requested short results and the third
one to those that have requested results as URL only. All three blocks
must be present in <TT
CLASS="filename"
>search.htm</TT
>. Furthermore there
is a series of navigation blocks and the blocks &#60;!--notfound--&#62;,
&#60;!--noquery--&#62; and &#60;!--error--&#62;. The latter are returned
occasionally instead of results.</P
><P
>Any HTML that is outside the pre-defined blocks in search.htm is completely ignored. </P
><P
>Thus, the output of <TT
CLASS="filename"
>search.cgi</TT
> will always be something like this:
		<PRE
CLASS="programlisting"
>&#13;				
  top                 
  restop                top                 top              top
  res            or     notfound      or    error     or     noquery
  resbot                bottom              bottom           bottom
  (navigation)
  bottom
			
			</PRE
>
</P
><P
>The navigation part is built in the same way,
with the elements that pertain to each results page. For example,
&#60;!--navleft--&#62; and &#60;!--navright--&#62; are used to link to the
previous and next results pages, while &#60;!--navXXX_nop--&#62; is used
when there are no more pages in one or either direction. </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="html-yourhtml"
>Your HTML</A
></H2
><P
>The simplest HTML is provided ready for use in
<TT
CLASS="filename"
>etc/search.htm-dist</TT
>. It is advisable that you use this
until your back-end works fine. </P
><P
>Once you decide to add bells and whistles to
your search, you have two options. One is to keep the simple design of
<TT
CLASS="filename"
>search.htm</TT
>, but make it part of a frame set. This
way you can add elements such as menus etc in a frame and keep the
output of <TT
CLASS="filename"
>search.htm</TT
> in another.</P
><P
>The other option is to incorporate your entire
design in <TT
CLASS="filename"
>search.htm</TT
>. If you fully understand the
"blocks" system described above, this should not be too difficult. The
one most important factor is to keep track of elements that need to be
opened in one block and closed in another. </P
><P
>For example, you might want a page in tables that looks like this:
		<PRE
CLASS="programlisting"
>&#13;                   ----------------------------------
                  |       top  table                 |
                  |..................................|
                  |        .                         |
                  |left    .                         |
                  |        .                         |
                  |        .         main table      |
                  |table   .                         |
                  |        .                         |
                  |        .                         |
                   ----------------------------------
</PRE
>
</P
><P
>If you are planning to put your results in the
main table, you can put all the HTML code in the &#60;!--top--&#62;
block of <TT
CLASS="filename"
>search.htm</TT
>, up to and including the
opening of the main table (&#60;table&#62;&#60;tr&#62;&#60;td&#62;). If you
then put the closing of the main table and the closing tags of the
page in the &#60;!--bottom--&#62; block
(&#60;/table&#62;&#60;/tr&#62;&#60;/td&#62;&#60;/body&#62;&#60;/html&#62;) and
leave all other blocks unformatted, you will have the design of your
choice and all your results in the right place. </P
><P
>In a more complicated design, where you want to
format results individually, you can apply the same method as long as
you keep track of the opening and closing of HTML elements. You must
either open and close them in the same block, or make sure that any
possible combination of blocks will result in properly opened and
closed HTML tags. </P
><P
>What you cannot do without editing the source
code, is change the order in which the blocks are parsed. Taking the
above example, let's assume that you want your page to look like this:
		<PRE
CLASS="programlisting"
>&#13;                   ----------------------------------
                  |  logo       banner ads           |
                  |..................................|
                  |            .                     |
                  |choices     .                     |
                  |            .                     |
                  |            .    results          |
                  |search      .                     |
                  |button      .                     |
                  |            .                     |
                   ----------------------------------
</PRE
>
</P
><P
>To get this, you need to have everything except
the results and navigation in the &#60;!--top--&#62; block, since that
is the only block that can draw the page even if there are no results
at all. In this case your search.htm would look like this:</P
><DIV
CLASS="informalexample"
><A
NAME="AEN3501"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13; &#60;!--variables--&#62;
  [your configuration]
 &#60;!--/variables--&#62;

 &#60;!--top--&#62;
  &#60;html&#62;
  &#60;body&#62;
  &#60;table&#62;
    &#60;tr colspan="2"&#62;
    &#60;td&#62;[logo, banner ads]&#60;/td&#62;
    &#60;/tr&#62;
    &#60;tr&#62;
    &#60;td&#62;[search form]&#60;/td&#62;
    &#60;td&#62;
  &#60;!--/top--&#62;

  [all other blocks in search.htm except "bottom"]

  &#60;!--bottom--&#62;
    [closing elements like the mnogosearch link 
     and a link to the webmaster]
    &#60;/td&#62;
    &#60;/tr&#62;
  &#60;/table&#62;
  &#60;/body&#62;
  &#60;/html&#62;
  &#60;!--/bottom--&#62;
		</PRE
><P
></P
></DIV
><P
>The individual blocks can be formatted
individually as long as that formatting is closed within each
block. Thus, nothing stops you from doing things like </P
><DIV
CLASS="informalexample"
><A
NAME="AEN3504"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13;  &#60;!--error--&#62;
    &#60;table&#62;
    &#60;tr&#62;&#60;td bgcolor"red"&#62;
      &#60;font color="#ffffff"&#62;  
      [error variables]
      &#60;/font&#62;
    &#60;/tr&#62;&#60;td&#62;
    &#60;/table&#62;
  &#60;!--error--&#62;
		</PRE
><P
></P
></DIV
><P
>as long as such formatting is opened and closed properly within the same block. </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="html-forms"
>Forms considerations</A
></H2
><P
>Most modern browsers can handle forms that
stretch over different tables, but writing such forms is against all
standards and is bad HTML. Unless you really can't avoid it, don't do
it. </P
><P
>For example, </P
><DIV
CLASS="informalexample"
><A
NAME="AEN3511"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13;  &#60;table&#62;
  &#60;tr&#62;&#60;td&#62;
     &#60;form&#62;
     &#60;input type="text" name="something"&#62;
     &#60;input type="radio" name"button1"&#62;
     &#60;input type="radio" name"button2"&#62;
     &#60;/form&#62;
  &#60;/tr&#62;&#60;/td&#62;
  &#60;/table&#62;
			</PRE
><P
></P
></DIV
><P
>is fine, but </P
><DIV
CLASS="informalexample"
><A
NAME="AEN3514"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13;  &#60;table&#62;
    &#60;tr&#62;&#60;td&#62;
       &#60;form&#62;
       &#60;input type="text" name="something"&#62;
    &#60;/tr&#62;&#60;/td&#62;
  &#60;/table&#62;
  &#60;table&#62;
    &#60;tr&#62;&#60;td&#62;
       &#60;input type="radio" name"button1"&#62;
       &#60;input type="radio" name"button2"&#62;
       &#60;/form&#62;
    &#60;/tr&#62;&#60;/td&#62;
    &#60;/table&#62;
			</PRE
><P
></P
></DIV
><P
>is <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>not</I
></SPAN
>.</P
><P
>Note that the input forms in search.htm can be
changed at will. The default is drop-down menus, but nothing stops you
from using radio buttons or hidden input or even text boxes. For
instance, where <TT
CLASS="filename"
>search.htm</TT
> says </P
><DIV
CLASS="informalexample"
><A
NAME="AEN3520"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13;  Results per page:
  &#60;SELECT NAME="ps"&#62;
  &#60;OPTION VALUE="10" SELECTED="$ps"&#62;10
  &#60;OPTION VALUE="20" SELECTED="$ps"&#62;20
  &#60;OPTION VALUE="50" SELECTED="$ps"&#62;50
  &#60;/SELECT&#62;
			</PRE
><P
></P
></DIV
><P
>you can very well substitute </P
><DIV
CLASS="informalexample"
><A
NAME="AEN3523"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13;  &#60;input type="radio" name"ps" value="10"&#62;
  &#60;input type="radio" name"ps" value="20" checked&#62;
  &#60;input type="radio" name"ps" value="50"&#62;
			</PRE
><P
></P
></DIV
><P
>which will result in three radio buttons instead
of a drop-down menu, with "20" as the default and the exact same
functionality. What you obviously cannot do is provide multiple-choice
menus like &#60;type="checkbox"&#62; or &#60;select multiple&#62;. </P
><P
>Note that you can also use the </P
><DIV
CLASS="informalexample"
><A
NAME="AEN3527"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13;  &#60;input type="hidden" name="XX" value="YY"&#62;
  			</PRE
><P
></P
></DIV
><P
>format if you want to set other defaults than the pre-defined and not allow the user to change them. </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="html-rellinks"
>Relative links in search.htm</A
></H2
><P
>It might be worth mentioning that
<TT
CLASS="filename"
>search.htm</TT
> is parsed from your cgi-bin
directory. The position of this directory in relation to your document
root is determined by the web server, independently of its actual
position in the file system. Almost invariably is
http://your_document_root/cgi-bin/ . Since
<TT
CLASS="filename"
>search.cgi</TT
> lives in cgi-bin, any links to images
etc in search.htm will assume cgi-bin as the base
directory. Therefore, if you have a file system structure like </P
><DIV
CLASS="informalexample"
><A
NAME="AEN3535"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13;   home/
   home/your_document_root/
   home/your_document_root/img/
   home/cgi-bin/
			</PRE
><P
></P
></DIV
><P
>the correct relative link from <TT
CLASS="filename"
>search.cgi</TT
> to images in img/ would still be </P
><P
>&#60;img src="../img/image.gif"&#62;</P
><P
>despite the fact that it doesn't match the file system structure.</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="html-searchform"
>Adding Search form to other pages</A
></H2
><P
>To place a search form to any of your pages,
please place the following code where you would like the form to be
displayed:</P
><DIV
CLASS="informalexample"
><A
NAME="AEN3544"
></A
><P
></P
><PRE
CLASS="programlisting"
>&#13;&#60;FORM 
	METHOD=GET 
	ACTION="http://path-to-search.cgi"&#62;
      &#60;INPUT TYPE="text" NAME="q" VALUE=""&#62;
      &#60;INPUT TYPE="submit" VALUE="Search!"&#62;

&#60;/FORM&#62;
</PRE
><P
></P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="msearch-templates.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="msearch-rel.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>How to write search result templates
<A
NAME="AEN3083"
></A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="msearch-doingsearch.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Relevancy
<A
NAME="AEN3548"
></A
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>