id
50
*
*/
include '../../../wbLoader.php';
header( 'Content-Type: text/html; charset=utf-8;' );
class WikipediaSearch
{
/**
* @var WBDatasource_Table
*/
protected $table;
/**
* @var WBWikipedia_Index
*/
protected $index;
public function __construct()
{
$this->index = WBClass::create( 'WBWikipedia_Index' );
$this->index->setLang( 'de' );
}
public function seek( $title )
{
$list = array();
$num = $this->index->find( $title, $list );
return $list;
}
}
$ws = new WikipediaSearch();
$search = 'Whopper';
if( $_GET['s'] ) {
$search = $_GET['s'];
}
?>
seek( $search );
echo "\n";
foreach( $list as $l ) {
echo " - \n ";
$urlParams = array(
'title' => $l['title'],
'oldid' => $l['latest']
);
$url = 'http://de.wikipedia.org/w/index.php?' . http_build_query( $urlParams );
$title = str_replace( '_', ' ', $l['title'] );
echo '' . $title . '
Link '. $url . '';
echo " \n";
}
echo "
\n";
?>