You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
<?php // generate an html page from database objects
|
|
|
|
// import database configuration and functions
|
|
require("db.php3");
|
|
require("html.php3");
|
|
|
|
// get page info from the database
|
|
$connection = connect($host, $dbname);
|
|
if($connection) {
|
|
// setup page query
|
|
$query = "select * from page where content = \"$content\"";
|
|
$result = query($connection, $query);
|
|
$count = numrows($result);
|
|
if($count) {
|
|
$page = fetch_object($result,0);
|
|
free_result($result);
|
|
$pid = start($page);
|
|
// query for page items
|
|
$query = "select * from item where pid=\"$pid\" order by ord";
|
|
$result = query($connection, $query);
|
|
$count = numrows($result);
|
|
if($count) { // call a $type function for each item
|
|
for($row=0; $row < $count; $row++) {
|
|
$data = fetch_object($result, $row);
|
|
$function = (($data->type) ? $data->type : "text");
|
|
$function($data);
|
|
}
|
|
free_result($result);
|
|
} else { include("unfinished.php3"); }
|
|
finish($page);
|
|
} else { include("unavailable.php3"); }
|
|
close($connection);
|
|
}
|
|
?>
|