|
$start= strpos($code, " ");
$length= $finish-$start;
$code=substr($code, $start, $length);
//parsing to find out how many results there are
$start= strpos($playcode, "_numhits=");
$finish= strpos($playcode, "%26q");
$playcode=substr($playcode, $start, $length);
preg_match("/([0-9]+)/",$playcode,$playmatches);
if (count($playmatches)>0) {
$result_count = $playmatches[1];
}
else {
$result_count = 0;
}
if( $sort=="relevance" )
{
print " ";
}
elseif( $sort=="date" )
{
print " ";
}
$newcode = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $domain . "\\2", $code);
if ($result_count >3){
echo ' Current news on '.$searchterm.':
';
echo str_replace("href=\"","href=\"page.php?cat=web&q=$searchterm&o=$offset&_sb_lang=$language&rys=$filter&page=", $newcode);
}
else{
include 'noresults.php';
}
?>
|
$thispage = $offset/10 + 1;
if ($result_count < 1000){
$maxpage = (int)($result_count / 10);
}
elseif ($result_count > 1000){
$maxpage = 100;
}
$firstlink = $thispage - 6;
if ($firstlink < 1) {
$nextupper = 1 - $firstlink;
$firstlink = 1;
} else {
$nextupper = 0;
}
$lastlink = min($thispage + 3 + $nextupper,$maxpage);
if ($thispage > 1) {
print "prev ";
}
for ($i=$firstlink;$i<=$lastlink;$i++) {
$newoffset = ($i - 1) * 10;
if ($i==$thispage) {
print "$i ";
} else {
print "$i ";
}
}
if ($thispage < $maxpage) {
print "next ";
}
?>
|
|
|