themes
This commit is contained in:
parent
702f37ccc5
commit
1025fcf1e1
@ -96,21 +96,28 @@
|
|||||||
function loadThemeConfig($_theme) {
|
function loadThemeConfig($_theme) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if(!file_exists($config['dir']['homepage'] . '/' . $_theme . '/theme.php'))
|
if(!file_exists($config['dir']['homepage'] . '/' . $_theme . '/info.php'))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Load theme information into $theme
|
// Load theme information into $theme
|
||||||
include $config['dir']['homepage'] . '/' . $_theme . '/theme.php';
|
include $config['dir']['homepage'] . '/' . $_theme . '/info.php';
|
||||||
return $theme;
|
return $theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rebuildTheme($action) {
|
function rebuildTheme($action) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
$query = query("SELECT `value` AS `theme` FROM `theme_settings` WHERE `name` = 'theme'") or error(db_error());
|
$query = query("SELECT `value` AS `theme` FROM `theme_settings` WHERE `name` = 'theme'") or error(db_error());
|
||||||
if($theme = $query->fetch()) {
|
if($theme = $query->fetch()) {
|
||||||
// A theme is installed
|
// A theme is installed
|
||||||
|
$_theme = $theme['theme'];
|
||||||
|
|
||||||
$theme = loadThemeConfig($theme['theme']);
|
$theme = loadThemeConfig($_theme);
|
||||||
$theme['build_function']($action, themeSettings());
|
|
||||||
|
if(file_exists($config['dir']['homepage'] . '/' . $_theme . '/theme.php')) {
|
||||||
|
include $config['dir']['homepage'] . '/' . $_theme . '/theme.php';
|
||||||
|
$theme['build_function']($action, themeSettings());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,40 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
$theme = Array();
|
require 'info.php';
|
||||||
|
|
||||||
// Theme name
|
function basic_build($action, $settings) {
|
||||||
$theme['name'] = 'Basic';
|
// Possible values for $action:
|
||||||
// Description (you can use Tinyboard markup here)
|
// - all (rebuild everything, initialization)
|
||||||
$theme['description'] = 'Extremely basic news listing for the homepage. It\'s suggested that you enable boardlinks for this theme.';
|
// - news (news has been updated)
|
||||||
$theme['version'] = 'v0.9';
|
// - boards (board list changed)
|
||||||
|
|
||||||
// Theme configuration
|
Basic::build($action, $settings);
|
||||||
$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)
|
|
||||||
// - news (news has been updated)
|
|
||||||
// - boards (board list changed)
|
|
||||||
|
|
||||||
Basic::build($action, $settings);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
|
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
|
||||||
class Basic {
|
class Basic {
|
||||||
public static function build($action, $settings) {
|
public static function build($action, $settings) {
|
||||||
|
@ -1,44 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
$theme = Array();
|
require 'info.php';
|
||||||
|
|
||||||
// Theme name
|
function frameset_build($action, $settings) {
|
||||||
$theme['name'] = 'Frameset';
|
// Possible values for $action:
|
||||||
// Description (you can use Tinyboard markup here)
|
// - all (rebuild everything, initialization)
|
||||||
$theme['description'] =
|
// - news (news has been updated)
|
||||||
'Use a basic frameset layout, with a list of boards and pages on a sidebar to the left of the page.
|
// - boards (board list changed)
|
||||||
|
|
||||||
Users never have to leave the homepage; they can do all their browsing from the one page.';
|
Frameset::build($action, $settings);
|
||||||
$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)
|
|
||||||
// - 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
|
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
|
||||||
class Frameset {
|
class Frameset {
|
||||||
public static function build($action, $settings) {
|
public static function build($action, $settings) {
|
||||||
|
Loading…
Reference in New Issue
Block a user