<?php
/**
* This is a script that shows off the KnowMore class.
*/
include('knowmore.php');
$w = new KnowMore();
if ($_GET['select'])
{
list( $url, $name ) = $w->select($_GET['select']);
print "<a href='http://knowmore.org$url'>$name</a>";
exit;
}
if ($_POST['text'])
{
$output = $w->knoWiki( $_POST['text'] );
print $output;
exit;
}
?>
<html>
<h1>Search</h1>
This form searchs the database for a company. Near matches work.
It uses the select() method.
<form>
Search: <input type="text" name="select">
<input type="submit">
</form>
<hr>
<h1>WikiFication</h1>
This field can convert text with [braces] around company names into linked text. It's useful if you want to
link your content to knowmore.org. It uses the knoWiki() method.
<br>
<form method="POST">
<textarea name="text" rows="4" cols="40">[McDonalds], [Yum], [Pepsi], [Coca Cola], [Ford], [General Motors], and [Sears].</textarea>
<input type="submit" value="Link Up">
</form>
<h1>Listing</h1>
<p>
This is a listing of the entire database. It's done completely in javascript, and shows off the asJsArray() method.
</p>
<script type="text/javascript">
KnowMoreDb = <?=$w->asJsArray()?>
for( i=0; i < KnowMoreDb.length; i++ )
{
name = KnowMoreDb[i][0];
url = KnowMoreDb[i][1];
document.write( '<a href="' + url + '">' + name + '</a><br>' );
}
</script>
</html>
|