I have approx 60 static docs and I want to create a web page that can search for keywords in these documents and list them so that when i click on one of them it outputs it to the page.... any ideas where to start.

I want to use PHP as I am interested in learning about it more. Please help me and advise me if I need to change the static HTNL docs into another format.... any info would be great! Thanks,

    convert them to xhtml - with all lower case tags

    read the file into a string
    http://www.php.net/fopen
    http://www.php.net/fread

    use
    http://www.php.net/strip_tags

    then turn the resulting string into an array
    http://www.php.net/explode

    then use this function

    function count_occurences($in_ary) {
        $out_ary = array();
        foreach($in_ary as $word) {
            if(array_key_exists($word,$out_ary)) {
                $out_ary['word']++;
            } else {
                $out_ary['word'] = 0;
            } //end if
        } //end foreach
        return $out_ary;
    } //end count_occurences

    then see if the word exists in the array produced by this function with
    http://www.php.net/array_key_exists

    You can use the counts to do ordering by the number of times the word occurs but that is left as an exercise for the reader.

      Write a Reply...