cvs: phpweb / results.php

From: Date: Sun, 26 Feb 2006 21:44:05 +0000
Subject: cvs: phpweb / results.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-30693@lists.php.net to get a copy of this message
goba Sun Feb 26 21:44:05 2006 UTC Modified files: /phpweb results.php Log: add some HTML list markup, so that we can hook some CSS to it (will add the CSS later) http://cvs.php.net/viewcvs.cgi/phpweb/results.php?r1=1.1&r2=1.2&diff_format=u Index: phpweb/results.php diff -u phpweb/results.php:1.1 phpweb/results.php:1.2 --- phpweb/results.php:1.1 Sun Feb 26 20:51:28 2006 +++ phpweb/results.php Sun Feb 26 21:44:05 2006 @@ -1,32 +1,43 @@ <?php -// $Id: results.php,v 1.1 2006/02/26 20:51:28 rasmus Exp $ +// $Id: results.php,v 1.2 2006/02/26 21:44:05 goba 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']; +else { $q = $_GET['q']; } $q = urlencode($q); -$s = (int)$_GET['start']; +$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; +// No results +if ($res['ResultSet']['totalResultsAvailable'] == 0) { + echo '<h2>No pages matched your query</h2>'; +} -foreach($res['ResultSet']['Result'] as $i=>$hit) { - $cnt = $pos+$i; - $d = date('r',$hit['ModificationDate']); +// Got results +else { echo <<<EOB -$cnt. <a href="{$hit['Url']}">{$hit['Title']}</a><br /> -&nbsp; &nbsp; {$hit['Summary']}<br /> -&nbsp; &nbsp; <font size=-1>Modified $d -&nbsp; &nbsp; <a href="{$hit['Cache']['Url']}">Cache ({$hit['Cache']['Size']} bytes)</a></font><br /> - +<h2>Showing {$res['ResultSet']['totalResultsReturned']} of {$res['ResultSet']['totalResultsAvailable']}</h2> +<ul id="search-results"> +EOB; + foreach($res['ResultSet']['Result'] as $i => $hit) { + $cnt = $pos + $i; + $d = date('r', $hit['ModificationDate']); + echo <<<EOB +<li> + <p class="result">$cnt. <a href="{$hit['Url']}">{$hit['Title']}</a></p> + <p class="summary">{$hit['Summary']}</p> + <p class="meta">Modified $d <a href="{$hit['Cache']['Url']}">Cache ({$hit['Cache']['Size']} bytes)</a></p> +</li> +EOB; + } + echo <<<EOB +</ul> EOB; } ?>

« previous php.mirrors (#30693) next »