PHP
  Home arrow PHP arrow Search This!
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Search This!
By: Colin Viebrock
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 24
    1999-03-15


    Table of Contents:
  • Search This!
  • Configuring ht://Dig
  • Indexing the Site
  • Building the Search Page
  • Performing the Search
  • Displaying the Results

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Search This!
    ( Page 1 of 6 )

    Add search capabilities to your site using the popular open source tools PHP3 and ht://Dig.So, you want to put a "Search This Site" button on your PHP3 sites? Well, unless all your pages are stored in a database (ugh!), there is no easy way to do this using PHP alone.

    The solution is to use another program designed specifically for indexing and searching your site, and then use the results of that program in your PHP script.

    When I first needed this functionality for a site I was designing for the SummerWorks Theatre Festival, I came across ht://Dig. For those who don't know, "The ht://Dig system is a complete world wide web indexing and searching system for a small domain or intranet. ... [It] is meant to cover the search needs for a single company, campus, or even a particular sub section of a web site."

    This tutorial will cover the following steps needed to get these two great Open Source applications working together:

    1. Installing ht://Dig
    2. Configuring ht://Dig
    3. Indexing the Site
    4. Building the Search Page
    5. Performing the Search
    6. Parsing and Displaying the Results

    Installing ht://Dig

    I'm not going to spend much time on this section, since the ht://Dig documentation can answer any questions much better than I can in this tutorial.

    As of this writing, the latest version of ht://Dig is 3.1.0b4. The latest version can always be found at http://www.htdig.org.

    Once you've downloaded the archive, and unzipped it, read the README and htdocs/install.html files for the latest information and instructions on how to install. I'm running Linux 2.0.35 and Apache 1.3.3, so your set-up may vary, but the first step is to run the configuration program.


    % ./configure

    You may then want to edit the CONFIG file. Specifically I changed these four settings to the following values:

    prefix =      /usr/local/htdig
    CGIBIN_DIR =  /usr/local/htdocs/htdig/cgi-bin
    IMAGE_DIR =   /usr/local/htdocs/htdig
    SEARCH_DIR =  /usr/local/htdocs/htdig
    

    The last two settings aren't too important, because we're going to be making our own search script and interface using PHP3.

    Once the CONFIG file is to your liking, run make and then make install:


    % make % make install

    If all went well, ht://Dig should be installed and we can move on to configuring it to work with PHP.



     
     
    >>> More PHP Articles          >>> More By Colin Viebrock
     

       

    PHP ARTICLES

    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek