'agentmd\'s blog', 'database' => 'blog.db', 'enableComments' => FALSE); // defaults $nav = array('home' => '?a=home', 'archives' => '?a=archives'); $content = 'Nothing to see here..'; // CODE STARTS HERE if(!$dbHandle = sqlite_open($config['database'], 0666, &$errStr)) { die($errStr); } $func = 'init_'.$_GET['a']; if(function_exists($func)) { $func(); } else { init_home(); } // REQUEST FUNCTIONS function init_home() { $posts = dbQuery('SELECT * FROM posts WHERE 1 ORDER BY post_pubdate DESC LIMIT 10', 'rows'); foreach($posts as $post) { $output .= formatPost($post); } setPageTitle("Home"); setContent($output); } function init_setup() { global $dbHandle; dbQuery('CREATE TABLE posts (post_id INTEGER PRIMARY KEY, post_subject TEXT, post_body TEXT, post_pubdate TEXT);'); dbQuery('INSERT INTO posts (post_subject, post_body, post_pubdate) VALUES ("Test", "This is a test of SQLite..", "2006-6-26");'); dbQuery('INSERT INTO posts (post_subject, post_body, post_pubdate) VALUES ("Second Test", "Return of the SQLite tests!", "2006-6-27");'); dbQuery('CREATE TABLE comments (comment_id INTEGER PRIMARY KEY, post_id INTEGER, comment_author TEXT, comment_email, comment_ip TEXT, comment_body TEXT);'); dbQuery('INSERT INTO comments (post_id, comment_author, comment_email, comment_ip, comment_body) VALUES (1, "foo", "foo@gmail.com", "127.0.0.1", "This is a test comment...");'); if($err) { die($err); } setContent('