forked from leftypol/leftypol
better rebuilding system for themes
This commit is contained in:
parent
757b09dec9
commit
641f925dfe
5 changed files with 54 additions and 18 deletions
|
@ -25,16 +25,22 @@
|
|||
// Unique function name for building everything
|
||||
$theme['build_function'] = 'basic_build';
|
||||
|
||||
function basic_build($settings) {
|
||||
Basic::build($settings);
|
||||
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
|
||||
class Basic {
|
||||
public static function build($settings) {
|
||||
public static function build($action, $settings) {
|
||||
global $config;
|
||||
|
||||
file_put_contents($config['dir']['home'] . $config['file_index'], Basic::homepage($settings));
|
||||
if($action == 'all' || $action == 'news')
|
||||
file_put_contents($config['dir']['home'] . $config['file_index'], Basic::homepage($settings));
|
||||
}
|
||||
|
||||
// Build news page
|
||||
|
|
|
@ -28,18 +28,28 @@ Users never have to leave the homepage; they can do all their browsing from the
|
|||
// Unique function name for building everything
|
||||
$theme['build_function'] = 'frameset_build';
|
||||
|
||||
function frameset_build($settings) {
|
||||
Frameset::build($settings);
|
||||
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($settings) {
|
||||
public static function build($action, $settings) {
|
||||
global $config;
|
||||
|
||||
file_put_contents($config['dir']['home'] . $config['file_index'], Frameset::homepage($settings));
|
||||
file_put_contents($config['dir']['home'] . 'sidebar.html', Frameset::sidebar($settings));
|
||||
file_put_contents($config['dir']['home'] . 'news.html', Frameset::news($settings));
|
||||
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
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 7.4 KiB |
Loading…
Add table
Add a link
Reference in a new issue