User manual
Overview
The XSearch script is a powerfull javascript search engine. This version5
is an improved version of the older v4.x versions. One of the main changes
is that it's not compatible with 3.0 browsers. There are some other minor
changes and some things have been left out because not many people used
it. If you still want the functionality of the previous versions please
download version4.3 from the dynamic-core.net website http://www.dynamic-core.net.
Note that XSearch5 is much faster, and more customizeable then the older
versions.
Files explained
The following files are supplied with XSearch5:
- db.js
- This file contains the database as it is used by XSearch to search
through.
- manual.htm
- xsearch.css
- A cascading style sheet file, used to define the markup of the
text in XSearch.
- xsearch-5.2.js
- The XSearch5.2 javascript engine (the core).
- xsearch-5.2.htm
- The example html file, that will show you a working XSearch5 engine.
Creating the Database
WARNING: Updated for version5.2, the db.js file is now created in
another way, please read!
This chapter will explain how you can fill the XSearch database with your
own url's and keywords.
The db.js file contains the definition of the database needed by XSearch.
XSearch is build using Javascript, this has the advantage that everybody
can use it without the need for a cgi-bin or other server side options.
The disadvantage of using Javascript is that it's impossible to search
through directory structures and files on the server. So you'll have to
create the database manually for every page in your website.
Entries
Every XSearch database entry (record) is created using three text array's.
The first of these arrays will contain a working link to the target html
file, the second array contains a set of keywords, and finally the third
array contains a description of the current database entry. Xsearch adds
a new function called add() you can use this to add the record information
to the database:
add(url,keywords,description)
example:
add("<a href='http://www.dynamic-core.net'>dynamic-core.net</a>","great
dhtml xsearch javascript search engine","This is the homepage
of dynamic-core.net, including the XSearch5.0 homepage")
As you can see in the above example, it's very simple to create a new
record.
XSearch CSS style sheet
The xsearch.css file, contains the styles used by the XSearch5 engine
to display the different text lines. By modifying this file, you can change
the look of every text line used in the XSearch engine. This is a big
improvement over the old XSearch engines that could only change the color
of the fonts.
- h3
- Small header text used for the "showing results ... "
line at the top of the results page.
- p
- Used for output of normal text, as example see the No results
page, and then the line that says: "Your search ... did not
match..."
- li
- Used on the No results page, to list the options for a better
searching-result.
- xtitle
- Used to display the link in every record of the results.
- xresult
- Used to show the description of every record.
- xlocation
- Used to display the link in text (below the description)
- xsmall
- This is used for the "Previous" and "Next"
page text.
Configuration parameters
The db.js file contains a few variables that need to be set to make the
search work correctly.
- searchname
- As with the previous xsearch versions, this variable defines the
xsearch filename. This is basiclly the current file name.
- usebannercode
- This variable was also used in previous versions, it defines if
you want to show the banner code, set it to true or false.
- ButtonCode
- This has changed from the previous version. Xsearch5 doesn't use
an image to search. You can put in any code you want, for example,
if you want to make it look like the previous xsearch versions do
this:
ButtonCode = "<img src='searchbutton.gif' border=0>"
templateBody() , templateEnd() and bannerCode() for more information
on these functions, read the article: Setting
up your own search engine. That article was written for the older
versions of XSearch, but the templateBody(), templateEnd() and bannerCode()
workings haven't changed.
Making it work
Finally you'll have to create a HTML file that links the XSearch5 engine
and the database like this:
Warning: The order of linking the two files is very important, make
sure the xsearch-5.js file is linked first, and the db.js file second..
otherwise you'll get some error messages.
<html>
<head>
<title>Xsearch 5</title>
<script language="Javascript" src="xsearch-5.2.js"></script>
<script language="Javascript" src="db.js"></script>
<body bgColor="#ffffff">
<script language="Javascript">
initXsearch()
</script>
</body>
</html>
Contact information
If you have any questions after this manual, please browse through the
old XSearch FAQ and knowledge base articles (http://www.dynamic-core.net)
before mailing me. Most problems have already been explained in one of
those files. If you still can't get it to work you can mail me: <pascal@dynamic-core.net>
Last modified 2000-07-20 |