cvs: phpweb / results.php
| From: | Rasmus Lerdorf | Date: | Sun, 26 Feb 2006 20:51:28 +0000 |
| Subject: | cvs: phpweb / results.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-30692@lists.php.net to get a copy of this message | ||
rasmus Sun Feb 26 20:51:28 2006 UTC
Added files:
/phpweb results.php
Log:
First step towards integrated search results
http://cvs.php.net/viewcvs.cgi/phpweb/results.php?view=markup&rev=1.1
Index: phpweb/results.php
+++ phpweb/results.php
<?php
// $Id: results.php,v 1.1 2006/02/26 20:51:28 rasmus Exp $
$_SERVER['BASE_PAGE'] = 'results.php';
#include $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
#include $_SERVER['DOCUMENT_ROOT'] . '/include/loadavg.inc';
// Prepare data for search
if ($MQ) { $q = stripslashes($_GET['q']); }
else $q = $_GET['q'];
$q = urlencode($q);
$s = (int)$_GET['start'];
$data = file_get_contents("http://www.php.net/~rasmus/ws.php?q=$q&results=10&start=$s");
$res = unserialize($data);
$pos = $res['ResultSet']['firstResultPosition'];
echo <<<EOB
<h2>Showing {$res['ResultSet']['totalResultsReturned']} of
{$res['ResultSet']['totalResultsAvailable']}</h2>
EOB;
foreach($res['ResultSet']['Result'] as $i=>$hit) {
$cnt = $pos+$i;
$d = date('r',$hit['ModificationDate']);
echo <<<EOB
$cnt. <a href="{$hit['Url']}">{$hit['Title']}</a><br
/>
{$hit['Summary']}<br />
<font size=-1>Modified $d
<a href="{$hit['Cache']['Url']}">Cache
({$hit['Cache']['Size']} bytes)</a></font><br />
EOB;
}
?>