Chercher dans les photos de nature
Résultats de la recherche pour =$strSearch?>
$lcCle", $high);
$high = ereg_replace($ucCle, "
$ucCle", $high);
return $high;
}
function removeAccents($tHtml) {
return preg_replace("/\&(a|e|i|o|u)[acute;|grave;|circ;]/", "$1", $tHtml);
}
function getResultHtml($file, $title, $match) {
$thumb = ereg_replace(".html", ".jpg", $file);
$html = "
" .
" $title $match | ";
return $html;
}
$cle = $_GET['search'];
$nRes = 0;
$nMaxRes = 12;
// echo "
";
if ($cle == "") {
echo "Critère de recherche non valide";
}
elseif ($dh = opendir("pages")) {
echo "";
while (($file = readdir($dh)) !== false && $nRes < $nMaxRes) {
if (ereg("\.html", $file)) {
$doSearch = false;
$recMatch = false;
$fileContent = file("pages/$file");
$recTitle = "Sans titre";
$matchText = "";
foreach ($fileContent as $lineNum => $line) {
if (preg_match("/(.+)", $line, $matched)) {
$recTitle = $matched[1];
$doSearch = true;
}
if (eregi($cle, $recTitle)) {
$recMatch = true;
$recTitle = highlight($cle, $recTitle);
}
if (ereg("id=\"bottomLinks", $line)) $doSearch = false;
if ($doSearch) {
$text = preg_replace('@<[\/\!]*?[^<>]*?>@si', "", $line);
if (!$recMatch && eregi($cle, $text)) {
$recMatch = true;
$htext = highlight($cle, $text);
$matchText .= "\n$htext";
}
}
}
if ($recMatch) {
// echo "
- $recTitle
$matchText ";
// echo "- $recTitle
";
echo getResultHtml($file, $recTitle, $matchText);
$nRes++;
if ($nRes % 4 == 0) {
echo "
";
}
}
}
}
echo "
";
}
// echo "
";
if ($nRes==0) {
echo "Aucun résultat.";
}
}
?>