Browse Source

themes

pull/40/head
Savetheinternet 13 years ago
parent
commit
1025fcf1e1
  1. 13
      inc/functions.php
  2. 29
      templates/homepage/basic/theme.php
  3. 31
      templates/homepage/frameset/theme.php

13
inc/functions.php

@ -96,23 +96,30 @@
function loadThemeConfig($_theme) {
global $config;
if(!file_exists($config['dir']['homepage'] . '/' . $_theme . '/theme.php'))
if(!file_exists($config['dir']['homepage'] . '/' . $_theme . '/info.php'))
return false;
// Load theme information into $theme
include $config['dir']['homepage'] . '/' . $_theme . '/theme.php';
include $config['dir']['homepage'] . '/' . $_theme . '/info.php';
return $theme;
}
function rebuildTheme($action) {
global $config;
$query = query("SELECT `value` AS `theme` FROM `theme_settings` WHERE `name` = 'theme'") or error(db_error());
if($theme = $query->fetch()) {
// A theme is installed
$_theme = $theme['theme'];
$theme = loadThemeConfig($theme['theme']);
$theme = loadThemeConfig($_theme);
if(file_exists($config['dir']['homepage'] . '/' . $_theme . '/theme.php')) {
include $config['dir']['homepage'] . '/' . $_theme . '/theme.php';
$theme['build_function']($action, themeSettings());
}
}
}
function themeSettings() {
$query = query("SELECT * FROM `theme_settings`") or error(db_error());

29
templates/homepage/basic/theme.php

@ -1,31 +1,6 @@
<?php
$theme = Array();
require 'info.php';
// Theme name
$theme['name'] = 'Basic';
// Description (you can use Tinyboard markup here)
$theme['description'] = 'Extremely basic news listing for the homepage. It\'s suggested that you enable boardlinks for this theme.';
$theme['version'] = 'v0.9';
// Theme configuration
$theme['config'] = Array();
$theme['config'][] = Array(
'title' => 'Title',
'name' => 'title',
'type' => 'text'
);
$theme['config'][] = Array(
'title' => 'Slogan',
'name' => 'subtitle',
'type' => 'text'
);
// Unique function name for building everything
$theme['build_function'] = 'basic_build';
if(!function_exists('basic_build')) {
function basic_build($action, $settings) {
// Possible values for $action:
// - all (rebuild everything, initialization)
@ -34,7 +9,7 @@
Basic::build($action, $settings);
}
}
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Basic {
public static function build($action, $settings) {

31
templates/homepage/frameset/theme.php

@ -1,34 +1,6 @@
<?php
$theme = Array();
require 'info.php';
// Theme name
$theme['name'] = 'Frameset';
// Description (you can use Tinyboard markup here)
$theme['description'] =
'Use a basic frameset layout, with a list of boards and pages on a sidebar to the left of the page.
Users never have to leave the homepage; they can do all their browsing from the one page.';
$theme['version'] = 'v0.1';
// Theme configuration
$theme['config'] = Array();
$theme['config'][] = Array(
'title' => '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)
@ -37,7 +9,6 @@ Users never have to leave the homepage; they can do all their browsing from the
Frameset::build($action, $settings);
}
}
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
class Frameset {

Loading…
Cancel
Save