Archived
1
0
Fork 0

move more theme related functionality into the theme class (addresses #46)

This commit is contained in:
Jan Dittberner 2009-07-11 15:13:40 +00:00
parent fcea03a800
commit ded7232146
3 changed files with 43 additions and 24 deletions

View file

@ -28,6 +28,8 @@
* <http://www.gnu.org/licenses/>.
*/
require('includes/template.class.php');
/**
* Theme class.
*/
@ -52,6 +54,9 @@ class Theme {
*/
var $thumbsize;
var $name;
var $template;
/**
* Constructor for themes. Expects a theme name and initializes the
* internal state of the instance from the 'theme.ini' file in the
@ -61,10 +66,25 @@ class Theme {
function __construct($name) {
$themeconfig = parse_ini_file(
realpath(implode(DIRECTORY_SEPARATOR,
array('themes', $name, 'theme.ini'))));
array('themes', $name, 'theme.ini'))));
$this->name = $name;
$this->themetype = $themeconfig['themetype'];
$this->previewsize = intval($themeconfig['previewsize']);
$this->thumbsize = intval($themeconfig['thumbsize']);
}
function getTemplate() {
if (!$this->template) {
$this->template = new Template();
$this->template->assign('themepath',
implode(DIRECTORY_SEPARATOR, array('themes', $this->name)));
}
return $this->template;
}
function display() {
$this->template->display(implode(DIRECTORY_SEPARATOR,
array('themes', $this->name, 'theme.php')));
}
}
?>