\n" .
" id\">View this post only\n" .
" id\">Make a comment\n" .
"\n";
}
function entryForm($action, $command, $buttonText, $id=null) {
echo "\n";
}
function viewAll() {
entryForm("assignment2.php", "make_post", "Make Post");
foreach(BlogEntry::$rootEntries as $entry)
$entry->generateXHTML("makePostfix");
}
BlogEntry::readAll("blog_data.txt");
if(isset($_GET["command"])) { switch($_GET["command"]) {
case "make_post":
$entry=&BlogEntry::makeRootEntry();
$entry->subject=$_GET["subject"];
$entry->email=$_GET["email"];
$entry->setBody($_GET["body"]);
BlogEntry::writeAll("blog_data.txt");
viewAll();
break;
case "view_single":
$entry=&BlogEntry::getEntry($_GET["id"]);
$entry->generateXHTML("makePostfix");
entryForm("assignment2.php", "make_comment", "Make Comment", $entry->id);
break;
case "write_comment":
$entry=&BlogEntry::getEntry($_GET["id"]);
entryForm("assignment2.php", "make_comment", "Make Comment", $entry->id);
$entry->generateXHTML("makePostfix");
break;
case "make_comment":
$entry=&BlogEntry::getEntry($_GET["id"]);
$comment=&$entry->makeComment();
$comment->subject=$_GET["subject"];
$comment->email=$_GET["email"];
$comment->setBody($_GET["body"]);
BlogEntry::writeAll("blog_data.txt");
viewAll();
break;
} } else viewAll();
?>