1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adding search to a site which isn't database driven

Discussion in 'HTML, Graphics & Programming' started by theMAD2, 27 Jan 2006.

  1. theMAD2

    Hitman

    Joined: 2 Aug 2005

    Posts: 680

    Hi,

    Is it possible to to add a search facility to a site which is made up of lots of html pages (not database driven)? The site is also password protected using htaccess so I can't add a Google search. Thanks.
     
  2. Inquisitor

    Capodecina

    Joined: 12 Apr 2004

    Posts: 11,788

    Location: Birmingham

    Assuming you have some kind of server side scripting language available then yes, although it could get a bit messy, as you'd have to search the contents of each file for the search term :p I expect you could refine it to some extent, so that it ignores contents of tags, or you could even make it look at <meta name="keyword" content="keywords,go,here" /> if you wanted to.
     
    Last edited: 27 Jan 2006
  3. Dj_Jestar

    Caporegime

    Joined: 18 Oct 2002

    Posts: 28,816

    Location: Back in East London

    use cURL to retrieve the output from your scripts, then search through those.

    It may be wise to have a keywords function on your output scripts so that it leaves out the HTML and just outputs the content for you to search easily.
     
  4. theMAD2

    Hitman

    Joined: 2 Aug 2005

    Posts: 680

    I could use the meta data tags. Is there a way of doing this using XML?
    Thanks for your help.
     
  5. Dj_Jestar

    Caporegime

    Joined: 18 Oct 2002

    Posts: 28,816

    Location: Back in East London

    of course :)

    Setup and RSS/Atomic feed (which you can use locally as well) and searching will be a LOT easier, and quicker.

    Which language are you using?
     
  6. theMAD2

    Hitman

    Joined: 2 Aug 2005

    Posts: 680

    PHP, but I'm far from an expert :) Where's the best place to start?
     
  7. Dj_Jestar

    Caporegime

    Joined: 18 Oct 2002

    Posts: 28,816

    Location: Back in East London

    My experience with RSS is measured in Nano's, so all I can do is point you to an RSS package form PEAR -> http://pear.php.net/package/XML_RSS

    I'm certain other members have had RSS/Atomic feeds up and running and I doubt they are much fuss at all, especially with a package like that above.

    :)
     
  8. richard1973

    Gangster

    Joined: 22 Dec 2005

    Posts: 138

    Alternatively you can use a program by 'coffee cup' I think it's called 'search'. google their website and you'll see which app it is, they do a few apps for web related things.

    Your server will need PHP to run its scripts it generates, but basically you load up the html pages from your site into the application and it stores all the words in them to a file. It then generates the html code for your search button. You can tweak with layout and options.

    Then you just upload its generated files to your site along with your adjusted html page that has the search code now pasted in.

    good luck.