| 
<?php
 // Welcome to the Pork.Iframe ultrasimple testpageŽ
 // Step one: import ./sample_database.sql into mysql.
 // Step two: go to ./settings/dbsettings.php and adjust your connection info
 // Step three: Run this file in your local php webserver :-)
 
 // For more info: see http://www.schizofreend.nl/
 
 
 include('./includes/functions.php'); // this just defines the __autoload();
 
 global $db; // make sure it's called db and global. Pork.dbObject uses it.
 
 $db = new dbConnection('./settings/dbsettings.php'); // you probably want to move this somewhere out of your WWWroot.
 
 
 $weblog = new Blog(); // create an empty object to work with.
 $weblog->Author = 'SchizoDuckie'; // mapped internally to strAuthor.
 $weblog->Title = 'A test weblog';
 $weblog->Story = 'This is a test weblog!';
 $weblog->Posted = date("Y-m-d H:i:s");
 $weblog->Save(); // Checks for any changed values and inserts or updates into DB.
 
 
 $tag1 = new Tag(); // create a new tag to add to this weblog
 $tag1->Tag = 'TestTag';
 $weblog->connect($tag1);
 
 $reply = new Reaction(); // and a reply.
 $reply->Poster = 'Some guy';
 $reply->ReplyDate =  date("Y-m-d");
 $reply->Reaction = "woo hah!";
 $weblog->connect($reply);
 
 echo "Just inserted a new weblog with id: {$weblog->ID}, and added a tag and a reply<br>";
 // now fetch the last 10 posts by SchizoDuckie, order by posted desc.
 $weblogs = $weblog->Find("Blog", array("Author"=>"SchizoDuckie"), array("order by Posted desc", "limit 0,10"));
 
 if($weblogs != false)
 {
 foreach ($weblogs as $blog)
 {
 echo $blog->display();
 }
 }
 
 echo("These queries where executed:<pre>");
 print_r($db->queries);
 echo("</pre>");
 |