'Title', 'name' => 'title', 'type' => 'text' ); $theme['config'][] = Array( 'title' => 'Slogan', 'name' => 'subtitle', 'type' => 'text' ); // Unique function name for building everything $theme['build_function'] = 'frameset_build'; if(!function_exists('frameset_build')) { function frameset_build($action, $settings) { // Possible values for $action: // - all (rebuild everything, initialization) // - news (news has been updated) // - boards (board list changed) Frameset::build($action, $settings); } } // Wrap functions in a class so they don't interfere with normal Tinyboard operations class Frameset { public static function build($action, $settings) { global $config; if($action == 'all') file_put_contents($config['dir']['home'] . $config['file_index'], Frameset::homepage($settings)); if($action == 'all' || $action == 'boards') file_put_contents($config['dir']['home'] . 'sidebar.html', Frameset::sidebar($settings)); if($action == 'all' || $action == 'news') file_put_contents($config['dir']['home'] . 'news.html', Frameset::news($settings)); } // Build homepage public static function homepage($settings) { global $config; // HTML5 return '' . '' . '' . '' . '' . $settings['title'] . '' . '' // Sidebar . '' // Main . '' // Finish page . ''; } // Build news page public static function news($settings) { global $config; // HTML5 $body = '' . '' . '' . 'News' . ''; $body .= '

' . $settings['title'] . '

' . '
' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '
'; $query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error()); if($query->rowCount() == 0) { $body .= '

(No news to show.)

'; } else { // List news while($news = $query->fetch()) { $body .= '
' . '

' . ($news['subject'] ? $news['subject'] : 'no subject' ) . ' — by ' . $news['name'] . ' at ' . date($config['post_date'], $news['time']) . '

' . $news['body'] . '

'; } } // Finish page $body .= ''; return $body; } // Build sidebar public static function sidebar($settings) { global $config, $board; $body = '' . '' . '' . '' . '' . '' . $settings['title'] . '' . ''; $body .= '
' . $settings['title'] . '
'; $body .= '
Boards
'; // Finish page $body .= ''; return $body; } }; ?>