Although this tutorial no longer applies to my site, it is apparent that it may be of use to others. Feel free to send me corrections via comments.
Part 1 - Introduction
Part 2 - Obtaining and installing the web crawler/search engine
Part 3 - Creating the search/search results page in NetObjects Fusion
Part 4 - Quick recap (or refresher for the previously initiated)
Part 5 - Additional notes
Part 6 - Disclaimer
Setting up your own search engine for your NetObjects Fusion website can be quite easily accomplished and shouldn’t take much more than 5-10 minutes. Your visitors will appreciate the ability to search your website! I am using NetObjects Fusion 7. Some additional steps may be required for other versions. PHPDig is a freely available (Open Source) set of PHP scripts that enable you to embed a search engine into your website. PHPDig is easy to use, easy to implement, and quite fast. All you need is a PHP enabled web server and a MySql database. If your server meets these requirements, then we’re ready to get started!
Although I reference NetObjects Fusion in this tutorial, I think that this could be easily adapted to Macromedia Dreamweaver or Microsoft FrontPage as well.
Part 2 - Obtaining and installing the web crawler/search engine
PHPDig can be obtained from http://www.phpdig.net
in their downloads section. Grab the latest stable version, which is version 1.80 at the time of this writing.
Create a directory at the root of your web server’s html documents directory. This will most likely be where your index.html or home.html page is placed. For this tutorial, we’ll name the directory “spider".
Extract the PHPDig zipped file that you obtained above, into the “spider” directory, which you created in the previous step.
Because we placed PHPDig in a different directory than the root of the server, you will need to modify the line in /spider/includes/config.php
as follows:
Before:
if ((isset($relative_script_path)) &&($relative_script_path != ".") && ($relative_script_path !="..")) {
After:
if ((isset($relative_script_path))&& ($relative_script_path != ".") &&($relative_script_path != "..") && ($relative_script_path != "../spider")) {
Open a web browser, and go to the spider/admin directory of your server (i.e. http://yoursite/spider/admin/install.php).
Note: The username/password is admin/admin. Be sure to change this when you are done! The first time you go to this directory, you will be prompted for your MySql connection details. Enter your details, and then verify that you are able to index your site. If all went well, we are ready to move on to the next step!
Part 3 - Creating the search/search results page in NetObjects Fusion
I am going with the assumption that you have already published your website at least once, and you have NetObjects Fusion open.
Create a file called “search.template” in your site’s published html directory (where Fusion puts the majority of your web pages when you publish your site). You will most likely not want this file to show up in your site tree, so you will want to create the file outside of NetObjects Fusion using your favorite text editor.
search.template
<phpdig:form_head/><br />
<phpdig:form_field/><phpdig:form_button/>
<phpdig:form_select/><br />
<phpdig:form_radio/><phpdig:form_foot/>
<phpdig:result_message/><phpdig:ignore_message/>
<phpdig:ignore_commess/><br />
<phpdig:nav_bar/><br /><br />
<phpdig:results>
<phpdig:page_link/><br />
<phpdig:text/><br /><br />
</phpdig:results>
<br/><phpdig:nav_bar/>
Create a page in NetObjects Fusion, in your site tree, called “search".
Click on the search page that you just created in your site tree. Ensure that the “Properties Palette” is checked in the “View” menu. In the “Properties” dialog, click the “Custom Names…” button. In the “Custom Names” dialog, change the extension to ".php".

Locate the place in your search page where you want to embed your search results. It might be a good idea to type some text on your page
(like the word “Search") before continuing. This way you know exactly where your results will be displayed.
Press Ctrl+T to bring up the “Insert HTML” dialog.

Paste the following code into the “Insert HTML” dialog:
<?php
$relative_script_path = ‘../spider’;
include "$relative_script_path/includes/config.php";
include"$relative_script_path/libs/search_function.php";
extract(phpdigHttpVars(array(
‘query_string’=>’string’,
’refine’=>’integer’,
‘refine_url’=>’string’,
’site’=>’integer’,
‘limite’=>’integer’,
‘option’=>’string’,
‘lim_start’=>’integer’,
‘browse’=>’integer’,
‘path’=>’string’
)));
phpdigSearch($id_connect, $query_string, $option, $refine,
$refine_url, $lim_start, $limite, $browse, $site, $path, $relative_script_path,’search.template’);
?>
Note “search.template” in the “phpdigSearch” function call. If you didn’t call your template “search.template” or you placed the file in a different location, you will need to change “search.template” to reflect your change.
Congratulations, you should now be able to provide search capabilities to visitors of your site!
Part 4 - Quick recap (or refresher for the previously initiated)
- Create a folder on the root of your web server called “spider".
- Download and extract the PHPDig zip file, obtained from http://www.phpdig.net, to the spider directory created above.
- Add “&& ($relative_script_path !="../spider")” to /spider/includes/config.php
- Configure PHPDig for the proper MySql server from http://yoursite/spider/admin/install.php.
Note: The username/password is admin/admin. Be sure to change this when you are done! - Index your site.
- Create a file for your search template on your web server.
- Create a skeleton page in NetObjects Fusion.
- Embed the PHP script (from Part 3) in your page.
- Publish your website.
- Sit back and feel good about your web site knowing that your visitors can now find any information they want on your site!
When I click a link in the search results, the page opens in a new window. How do I fix this?
I can only assume that the purpose of this makes more sense if you are providing search results for multiple sites. If you don’t like it when clicking on a search result opens in a new window, you can change the word "target" on line# 648 of “libs/search_function.php” to "xtarget" or simply remove the “target” attribute.
CSS stylesheets
PHPDig uses a CSS class called “phpdig” to format the display of search results. I will provide the following example styles for your review, and leave implementing the styles as an exercise for the reader:
.phpdig { font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif,sans-serif; font-size: x-small;}
PHPDig uses a CSS class called “phpdigHighlight” to highlight the search result key words within the results. I will provide the following example styles for your review, and leave implementing the styles as an exercise for the reader:
.phpdigHighlight { background-color:rgb(230,230,230); font-family: Verdana,Tahoma,Arial,Helvetica,Sans-serif,sans-serif; font-size: x-small;}
Automating the indexing of your site
For my site, I created a script that can be invoked from a cron daemon running on the webserver. Here is what my script looks like:
#/bin/bash
cd /bin/spider/admin
echo `date` > spider.log
php -f spider.php all >>spider.log
Using the above script, I do not have to worry about manually running the site index! It all happens automagically! Actually the cron job does all of the work!J
Changing the MySql connection details after installation
You can reconfigure your connection details by going to http://yoursite/spider/admin/install.php and making your changes.
Documentation
This document is in no way a replacement for the documentation available from http://www.phpdig.net. It is your responsibility to ensure that you read and understand the documentation available for PHPDig.
Security
Be sure to check frequently for security updates and notices from phpdig.net. Always keep your version of PHPDig up to date.
Legal
I am in no way whatsoever affiliated with phpdig.net or PHPDig’s author. I make this tutorial available solely as a reference. As with any tutorial, script, or application, you use it at your own risk. If you do not agree to the terms stated in this disclaimer you must not use this tutorial. This is just common sense but it had to be stated.
