summaryrefslogtreecommitdiff
path: root/templates/themes
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-02-14 21:02:06 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-02-14 21:02:06 +1100
commitcdfd67c87a6177101f920acbdd33b94d00a13fda (patch)
tree531d236500dc37b939d9a559c61f46318156469d /templates/themes
parentbac326a3652fbc98b78db62fc29fc4b7691bbe48 (diff)
frameset theme: transition to twig, plus more configurable
Diffstat (limited to 'templates/themes')
-rw-r--r--templates/themes/frameset/frames.html16
-rw-r--r--templates/themes/frameset/info.php35
-rw-r--r--templates/themes/frameset/news.html33
-rw-r--r--templates/themes/frameset/sidebar.html40
-rw-r--r--templates/themes/frameset/theme.php98
5 files changed, 134 insertions, 88 deletions
diff --git a/templates/themes/frameset/frames.html b/templates/themes/frameset/frames.html
new file mode 100644
index 00000000..d1d23aaa
--- /dev/null
+++ b/templates/themes/frameset/frames.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html>
+<head>
+ <link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}">
+ <style type="text/css">
+ iframe{border:none;margin:0;padding:0;height:99%;position:absolute}
+ iframe#sidebar{left:0;top:0;width:15%}
+ iframe#main{border-left:1px solid black;left:15%;top:0;width:85%}
+ </style>
+ <title>{{ settings.title }}</title>
+</head>
+<body>
+ <iframe src="{{ settings.file_sidebar }}" id="sidebar" name="sidebar"></iframe>
+ <iframe src="{{ settings.file_news }}" id="main" name="main"></iframe>
+</body>
+</html>
diff --git a/templates/themes/frameset/info.php b/templates/themes/frameset/info.php
index ad42fc91..8cff78a9 100644
--- a/templates/themes/frameset/info.php
+++ b/templates/themes/frameset/info.php
@@ -2,19 +2,19 @@
$theme = Array();
// Theme name
- $theme['name'] = 'Frameset (alpha)';
+ $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.0.1';
+ $theme['version'] = 'v0.1';
// Theme configuration
$theme['config'] = Array();
$theme['config'][] = Array(
- 'title' => 'Title',
+ 'title' => 'Site title',
'name' => 'title',
'type' => 'text'
);
@@ -22,9 +22,34 @@ Users never have to leave the homepage; they can do all their browsing from the
$theme['config'][] = Array(
'title' => 'Slogan',
'name' => 'subtitle',
- 'type' => 'text'
+ 'type' => 'text',
+ 'comment' => '(optional)'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'Main HTML file',
+ 'name' => 'file_main',
+ 'type' => 'text',
+ 'default' => $config['file_index'],
+ 'comment' => '(eg. "index.html")'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'Sidebar file',
+ 'name' => 'file_sidebar',
+ 'type' => 'text',
+ 'default' => 'sidebar.html',
+ 'comment' => '(eg. "sidebar.html")'
+ );
+
+ $theme['config'][] = Array(
+ 'title' => 'News file',
+ 'name' => 'file_news',
+ 'type' => 'text',
+ 'default' => 'news.html',
+ 'comment' => '(eg. "news.html")'
);
// Unique function name for building everything
$theme['build_function'] = 'frameset_build';
-?> \ No newline at end of file
+?>
diff --git a/templates/themes/frameset/news.html b/templates/themes/frameset/news.html
new file mode 100644
index 00000000..538eb945
--- /dev/null
+++ b/templates/themes/frameset/news.html
@@ -0,0 +1,33 @@
+{% filter remove_whitespace %}
+<!doctype html>
+<html>
+<head>
+ <title>{{ settings.title }}</title>
+ <link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}"/>
+</head>
+<body>
+ <h1>{{ settings.title }}</h1>
+ <div class="title">{{ settings.subtitle }}</div>
+
+ <div class="ban">
+ {% if news|count == 0 %}
+ <p style="text-align:center" class="unimportant">(No news to show.)</p>
+ {% else %}
+ {% for entry in news %}
+ <h2 id="{{ entry.id }}">
+ {% if entry.subject %}
+ {{ entry.subject }}
+ {% else %}
+ <em>no subject</em>
+ {% endif %}
+ <span class="unimportant"> &mdash; by {{ entry.name }} at {{ entry.time|date(config.post_date) }}</span>
+ </h2>
+ <p>{{ entry.body }}</p>
+ {% endfor %}
+ {% endif %}
+ </div>
+
+ <p class="unimportant" style="margin-top:20px;text-align:center;">Powered by <a href="http://tinyboard.org/">Tinyboard</a> {{ config.version }} | <a href="http://tinyboard.org/">Tinyboard</a> Copyright &copy; 2010-2012 Tinyboard Development Group</p>
+</body>
+</html>
+{% endfilter %}
diff --git a/templates/themes/frameset/sidebar.html b/templates/themes/frameset/sidebar.html
new file mode 100644
index 00000000..171e4e93
--- /dev/null
+++ b/templates/themes/frameset/sidebar.html
@@ -0,0 +1,40 @@
+{% filter remove_whitespace %}
+<!doctype html>
+<html>
+<head>
+ <title>{{ settings.title }}</title>
+ <link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}"/>
+ <style type="text/css">
+ fieldset{margin:10px 0}
+ legend{width:100%;margin-left:-15px;background:#98E;border:1px solid white;color:white;font-weight:bold;padding:5px 5px}
+ ul{margin:0;padding:0}
+ li{list-style:none;padding:0 4px;margin: 0 4px}
+ li a.system{font-weight:bold}
+ </style>
+ <base target="main"/>
+</head>
+<body>
+ <fieldset>
+ <legend>{{ settings.title }}</legend>
+ <ul>
+ <li>
+ <a class="system" href="{{ settings.file_news }}">[News]</a>
+ </li>
+ </ul>
+ </fieldset>
+
+ <fieldset>
+ <legend>Boards</legend>
+ <ul>
+ {% for board in boards %}
+ <li>
+ <a href="{{ config.board_path|sprintf(board.uri) }}">
+ {{ board.title }}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </fieldset>
+</body>
+</html>
+{% endfilter %}
diff --git a/templates/themes/frameset/theme.php b/templates/themes/frameset/theme.php
index 7eac4b99..08db7d1d 100644
--- a/templates/themes/frameset/theme.php
+++ b/templates/themes/frameset/theme.php
@@ -16,13 +16,13 @@
global $config;
if($action == 'all')
- file_write($config['dir']['home'] . $config['file_index'], Frameset::homepage($settings));
+ file_write($config['dir']['home'] . $settings['file_main'], Frameset::homepage($settings));
if($action == 'all' || $action == 'boards')
- file_write($config['dir']['home'] . 'sidebar.html', Frameset::sidebar($settings));
+ file_write($config['dir']['home'] . $settings['file_sidebar'], Frameset::sidebar($settings));
if($action == 'all' || $action == 'news')
- file_write($config['dir']['home'] . 'news.html', Frameset::news($settings));
+ file_write($config['dir']['home'] . $settings['file_news'], Frameset::news($settings));
}
// Build homepage
@@ -30,61 +30,21 @@
global $config;
// HTML5
- return '<!DOCTYPE html><html>'
- . '<head>'
- . '<link rel="stylesheet" media="screen" href="' . $config['url_stylesheet'] . '"/>'
- . '<style type="text/css">'
- . 'iframe{border:none;margin:0;padding:0;height:99%;position:absolute}'
- . 'iframe#sidebar{left:0;top:0;width:15%}'
- . 'iframe#main{border-left:1px solid black;left:15%;top:0;width:85%}'
- . '</style>'
- . '<title>' . $settings['title'] . '</title>'
- . '</head><body>'
- // Sidebar
- . '<iframe src="sidebar.html" id="sidebar" name="sidebar"></iframe>'
- // Main
- . '<iframe src="news.html" id="main" name="main"></iframe>'
- // Finish page
- . '</body></html>';
+ return Element('themes/frameset/frames.html', Array('config' => $config, 'settings' => $settings));
}
// Build news page
public static function news($settings) {
global $config;
- // HTML5
- $body = '<!DOCTYPE html><html>'
- . '<head>'
- . '<link rel="stylesheet" media="screen" href="' . $config['url_stylesheet'] . '"/>'
- . '<title>News</title>'
- . '</head><body>';
-
- $body .= '<h1>' . $settings['title'] . '</h1>'
- . '<div class="title">' . ($settings['subtitle'] ? utf8tohtml($settings['subtitle']) : '') . '</div>';
-
$query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error());
- if($query->rowCount() == 0) {
- $body .= '<p style="text-align:center" class="unimportant">(No news to show.)</p>';
- } else {
- // List news
- while($news = $query->fetch()) {
- $body .= '<div class="ban">' .
- '<h2 id="' . $news['id'] . '">' .
- ($news['subject'] ?
- $news['subject']
- :
- '<em>no subject</em>'
- ) .
- '<span class="unimportant"> &mdash; by ' .
- $news['name'] .
- ' at ' .
- strftime($config['post_date'], $news['time']) .
- '</span></h2><p>' . $news['body'] . '</p></div>';
- }
- }
+ $news = $query->fetchAll(PDO::FETCH_ASSOC);
- // Finish page
- $body .= '</body></html>';
+ return Element('themes/frameset/news.html', Array(
+ 'settings' => $settings,
+ 'config' => $config,
+ 'news' => $news
+ ));
return $body;
}
@@ -93,39 +53,11 @@
public static function sidebar($settings) {
global $config, $board;
- $body = '<!DOCTYPE html><html>'
- . '<head>'
- . '<link rel="stylesheet" media="screen" href="' . $config['url_stylesheet'] . '"/>'
- . '<style type="text/css">'
- . 'fieldset{margin:10px 0}'
- . 'legend{width:100%;margin-left:-15px;background:#98E;border:1px solid white;color:white;font-weight:bold;padding:5px 5px}'
- . 'ul{margin:0;padding:0}'
- . 'li{list-style:none;padding:0 4px;margin: 0 4px}'
- . 'li a.system{font-weight:bold}'
- . '</style>'
- . '<base target="main" />'
- . '<title>' . $settings['title'] . '</title>'
- . '</head><body>';
-
- $body .= '<fieldset><legend>' . $settings['title'] . '</legend><ul>' .
- '<li><a class="system" href="news.html">[News]</a></li>' .
- '</ul></fieldset>';
-
-
- $body .= '<fieldset><legend>Boards</legend><ul>';
-
- $boards = listBoards();
- foreach($boards as &$_board) {
- openBoard($_board['uri']);
- $body .= '<li><a href="' .
- sprintf($config['board_path'], $board['uri']) .
- '">' . $board['name'] . '</a></li>';
- }
-
- $body .= '</ul></fieldset>';
-
- // Finish page
- $body .= '</body></html>';
+ return Element('themes/frameset/sidebar.html', Array(
+ 'settings' => $settings,
+ 'config' => $config,
+ 'boards' => listBoards()
+ ));
return $body;
}