PHP Classes

File: knowmoredemo.php

Recommend this page to a friend!
  Classes of John Kawakami   KnowMore   knowmoredemo.php   Download  
File: knowmoredemo.php
Role: Example script
Content type: text/plain
Description: A script to show off features.
Class: KnowMore
Extract links about companies listed in KnowMore
Author: By
Last change:
Date: 17 years ago
Size: 1,349 bytes


Class file image Download
 * This is a script that shows off the KnowMore class.

$w = new KnowMore();

if (
$url, $name ) = $w->select($_GET['select']);
"<a href='$url'>$name</a>";

if (
$output = $w->knoWiki( $_POST['text'] );

This form searchs the database for a company. Near matches work.
It uses the select() method.
    Search: <input type="text" name="select">
    <input type="submit">


This field can convert text with [braces] around company names into linked text. It's useful if you want to
link your content to It uses the knoWiki() method.
<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">

This is a listing of the entire database. It's done completely in javascript, and shows off the asJsArray() method.
<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>' );