> i have a site in php but not using database i want to
> add the search facilty in that site means user can
> search into the contents of the site .so how can i do
> that in php without using database.waiting for ur soon
> reply
Hello,
- First of all try to get a list of all files (php, html, etc)
- for each file,
-- get the contents, and then strip_tags($theContentOfOneFile);
-- try to find whether the keyword to be found is in the contents,
e.g. use substr_count() store the number of occurences in an array
$searchArray = array('fileName' => 'number_of_occurences')
- sort the array, e.g. arsort($searchArray)
- display the results
foreach($searchArray as $fileName => $occurences)
{
if ($occurences == 0) break;
// display as you wish
echo "Found in $fileName $occurences times<br>";
}
Hope it helps,
Nadim Attari
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php