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  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
Moblin 
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? 
PHP

Search This!
By: Colin Viebrock
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 21
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    Search This!


    (Page 1 of 6 )

    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

    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application
    - Sending MIME Email with PHP
    - Handling Files for a Project Management Appl...
    - Viewing and Editing Tasks for a Project Mana...
    - More on Private Methods with PHP 5 Member Vi...
    - Adding Tasks to a Project Management Applica...
    - Utilizing Private Methods with PHP 5 and Mem...
    - Making Changes in a Project Management Appli...
    - Defining Public and Protected Methods with M...
    - HTML for a Project Management Application
    - Using Subclasses and Accessors with Member V...
    - Implementing Internet Protocols with PHP
    - Project Management: The Application
    - Working with Private Properties to Protect P...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway