Using htdig search engine tool with php and Computer Engineering webhosting
This page is for clients who do their webhosting with computerengineering.ca and want to add the free htdig local search engine tool to their website using php.
Step 1: Ask for htdig
Request htdig php services by sending support an email. It is part of your webhosting services.
Step 2: run htdig
The first time you create this, you will need to run htdig. This can be done by ssh'ing into the web server, and running a command at the command line:
/usr/bin/rundig -v -s -c ~/conf/htdig.conf. Too complicated? Email support, and we'll do it for you.
We will also set up a "cron job" to refresh your database periodically so that you can have your website search catch new web pages that you have created.
Step 3: Put the following code into your website:
Make sure that you change the <yourhomewebdirectoryhere> to your home directory name. Go ahead and email us if you don't know what that is. Be sure to include your domain name in the email address so we know who you are.
Remember to have a ".php" suffix on your web page. This is only a section of your web page. It will need the usual html code at the top and below this code that all web pages need.
<!-- start htdig section -->
<?php
foreach ( $_POST as $key => $value ) {
$$key = trim( $value );
}
if ( isset( $f_search_submit ) && ! empty( $f_search_submit) ) {
include( "class.htdig.php" );
$l_htdig = new htdig;
$l_htdig->htsearch( $f_search,"","/home/<yourhomewebdirectoryhere>/conf/htdig.conf" );
}
?>
<h1>htdig Website Hosting Search</h1>
<form method="post" action="<?php echo $PHP_SELF; ?>">
Search for: <input type="text" name="f_search" SIZE=30 value="<?php echo $f_search; ?>">
<input type="submit" name="f_search_submit" value="Search">
</form>
<?php
if ( isset($f_search_submit) && ! empty ( $f_search_submit) ) {
$l_result_code = $l_htdig->display_results( );
}
?>
<!-- end htdig section -->
For more information about our products and services, please phone us at (780) 239-8494 (within Edmonton, Alberta, Canada), (403) 998-8494 (within Calgary, Alberta, Canada), (306) 717-7709 (Saskatoon), (416) 993-7027 (Toronto) 1-877-968-7626 or 1-877-807-0777 (toll free within North America).







