Sophie

Sophie

distrib > * > cooker > x86_64 > by-pkgid > 059f7a4aaf6fd1abf9c488af664ae035 > files > 334

mnogosearch-3.3.10-5.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Designing search.htm</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="mnoGoSearch 3.3.10 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="Template operators"
HREF="msearch-templates-oper.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"
><!--#include virtual="body-before.html"--><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
><SPAN
CLASS="application"
>mnoGoSearch</SPAN
> 3.3.10 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 10. Searching documents</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="msearch-templates-oper.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="html"
>Designing <TT
CLASS="filename"
>search.htm</TT
></A
></H1
><P
>&#13;    This section assumes that you are using
    the <ACRONYM
CLASS="acronym"
>CGI</ACRONYM
> front end.
  </P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="html-respage"
>How the search results page is created</A
></H2
><P
>The file template file <TT
CLASS="filename"
>search.htm</TT
>
    consists of a number of blocks delimited by <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
>
    comments starting with <TT
CLASS="literal"
>&#60;!--comment--&#62;</TT
>
    and ending with <TT
CLASS="literal"
>&#60;!--/comment--&#62;</TT
>.
    </P
><P
>There is a special block <TT
CLASS="literal"
>&#60;!--variables ... --&#62;</TT
>
    which is used to put <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>commands</I
></SPAN
> to.
    The other blocks form parts of the output.
    </P
><P
>The blocks <TT
CLASS="literal"
>&#60;--top--&#62;</TT
> and
    <TT
CLASS="literal"
>&#60;!--bottom--&#62;</TT
> are always returned
    to the user as the top and the bottom parts of the output
    page page respectively.
    </P
><P
>The three blocks
    <TT
CLASS="literal"
>&#60;!--restop--&#62;</TT
>,
    <TT
CLASS="literal"
>&#60;!--res--&#62;</TT
> and
    <TT
CLASS="literal"
>&#60;!--resbot--&#62;</TT
> are displayed
    to the user in case when a search query produced at
    least one result. The blocks  <TT
CLASS="literal"
>&#60;!--restop--&#62;</TT
>
    and <TT
CLASS="literal"
>&#60;!--resbot--&#62;</TT
> are displayed once,
    while the block <TT
CLASS="literal"
>&#60;!--res--&#62;</TT
> is displayed
    for every found document.
    </P
><P
>&#13;    Furthermore there is a serie of <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>page navigation</I
></SPAN
>
    blocks and the blocks
    <TT
CLASS="literal"
>&#60;!--notfound--&#62;</TT
>,
    <TT
CLASS="literal"
>&#60;!--noquery--&#62;</TT
> and
    <TT
CLASS="literal"
>&#60;!--error--&#62;</TT
>.
    The latter three blocks are returned occasionally
    in situations when search did not return any results.
    </P
><P
>&#13;     Any <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
> code that is outside the pre-defined
     blocks in <TT
CLASS="filename"
>search.htm</TT
> is completely ignored.
    </P
><P
>The output of <SPAN
CLASS="application"
>search.cgi</SPAN
>
    consists of these parts, depending on the situation:
<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 every results page.
    For example,
    <TT
CLASS="literal"
>&#60;!--navleft--&#62;</TT
> and
    <TT
CLASS="literal"
>&#60;!--navright--&#62;</TT
> are used to link to the
    previous and next results pages, while
    <TT
CLASS="literal"
>&#60;!--navXXX_nop--&#62;</TT
>
    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 <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
></A
></H2
><P
>The default <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
> template code 
    provided in <TT
CLASS="filename"
>search.htm-dist</TT
>
    is ready for use, so you may decide to use it 
    without applying any major modifications.
    </P
><P
>Once you decide to add bells and whistles to
    your search, you have multiple options. One option is to keep
    the simple design of <TT
CLASS="filename"
>search.htm</TT
> and
    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 frame.
    </P
><P
>Other option is to incorporate your entire
     design into <TT
CLASS="filename"
>search.htm</TT
>. As soon
     as you understand the idea of the <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>blocks</I
></SPAN
>
     described above, this should be easy to do.
    </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 <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
>
    code in the <TT
CLASS="literal"
>&#60;!--top--&#62;</TT
>
    block of <TT
CLASS="filename"
>search.htm</TT
>, up to and including the
    opening of the main table
    (<TT
CLASS="literal"
>&#60;table&#62;&#60;tr&#62;&#60;td&#62;</TT
>).
    If you then put the closing of the main table and the closing
    tags of the  page in the <TT
CLASS="literal"
>&#60;!--bottom--&#62;</TT
> block
    (<TT
CLASS="literal"
>&#60;/table&#62;&#60;/tr&#62;&#60;/td&#62;&#60;/body&#62;&#60;/html&#62;</TT
>)
    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 <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
> 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 <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
> 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 <TT
CLASS="literal"
>&#60;!--top--&#62;</TT
>
    block, since that is the only block that can draw the page even if
    there are no results at all. In this case your
    <TT
CLASS="filename"
>search.htm</TT
> would look like this:
    </P
><DIV
CLASS="informalexample"
><P
></P
><A
NAME="AEN5706"
></A
><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 <TT
CLASS="filename"
>search.htm</TT
> 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"
><P
></P
><A
NAME="AEN5710"
></A
><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
>Although the modern browsers can handle forms that
    stretch over different tables, writing this kind of forms
    abuses the standards and is usually considered as bad
    <ACRONYM
CLASS="acronym"
>HTML</ACRONYM
>. Unless you really can't avoid it,
    using this style is not recommended.
    </P
><P
>For example,</P
><DIV
CLASS="informalexample"
><P
></P
><A
NAME="AEN5718"
></A
><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"
><P
></P
><A
NAME="AEN5721"
></A
><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 <TT
CLASS="filename"
>search.htm</TT
>
    can be changed at will. The default is drop-down menus, but nothing
    stops you from using radio buttons or hidden input or text boxes.
    For instance, where <TT
CLASS="filename"
>search.htm</TT
> says </P
><DIV
CLASS="informalexample"
><P
></P
><A
NAME="AEN5728"
></A
><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"
><P
></P
><A
NAME="AEN5731"
></A
><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 the drop-down menu, with <TT
CLASS="literal"
>20</TT
>
    being the default page size.
    </P
><P
>Note that you can also use the </P
><DIV
CLASS="informalexample"
><P
></P
><A
NAME="AEN5736"
></A
><PRE
CLASS="programlisting"
>&#13;  &#60;input type="hidden" name="XX" value="YY"&#62;
        </PRE
><P
></P
></DIV
><P
>format if you want to set your own
    default values without allowing the user to change them.
    </P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="html-rellinks"
>Relative links in <TT
CLASS="filename"
>search.htm</TT
></A
></H2
><P
>It might be worth mentioning that
    <TT
CLASS="filename"
>search.htm</TT
> is parsed by 
    <SPAN
CLASS="application"
>search.cgi</SPAN
> which
    usually resides in the <TT
CLASS="filename"
>/cgi-bin/</TT
> directory
    of your Web server. When you open
    <TT
CLASS="literal"
>http://site-name/cgi-bin/search.cgi</TT
>
    in your browser, all <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>relative</I
></SPAN
>
    links are considered as relative to the
    <TT
CLASS="filename"
>/cgi-bin/</TT
> directory.
    Therefore, if you have a file system structure like
   </P
><DIV
CLASS="informalexample"
><P
></P
><A
NAME="AEN5749"
></A
><PRE
CLASS="programlisting"
>&#13;   /var/www/images/
   /var/www/html/
   /var/www/cgi-bin/
</PRE
><P
></P
></DIV
><P
>the correct relative link from <TT
CLASS="filename"
>search.cgi</TT
>
    to the images in <TT
CLASS="filename"
>/images/</TT
> will be
    </P
><P
><TT
CLASS="literal"
>&#60;img src="../images/image.gif"&#62;</TT
></P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="html-searchform"
>Adding a small Search form to the other pages of your site</A
></H2
><P
>To add a small search form to any of your pages,
    you can put the following code:
    </P
><DIV
CLASS="informalexample"
><P
></P
><A
NAME="AEN5759"
></A
><PRE
CLASS="programlisting"
>&#13;&#60;FORM METHOD="GET" ACTION="/cgi-bin/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-templates-oper.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>How to write search result templates
    <A
NAME="AEN5144"
></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"
>Template operators</TD
></TR
></TABLE
></DIV
><!--#include virtual="body-after.html"--></BODY
></HTML
>