diff --git a/includes/theme.class.php b/includes/theme.class.php
index b8ccdfe..67b2be7 100644
--- a/includes/theme.class.php
+++ b/includes/theme.class.php
@@ -28,6 +28,8 @@
* .
*/
+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')));
+ }
}
?>
\ No newline at end of file
diff --git a/index.php b/index.php
index 4fe31eb..138d682 100644
--- a/index.php
+++ b/index.php
@@ -47,35 +47,19 @@ $gallery = getCurrentGallery();
*/
$thumbinfo = getThumbNailInfo($gallery);
-require('includes/template.class.php');
-
-$template = new Template();
-
$scripts = array('js/jquery.js',
'js/jquery.colorBlend.js',
'js/jquery.lightbox.js',
'scripts/ourhandlers.js');
$styles = array('css/jquery.lightbox.css');
-$inlinestyles = sprintf("\n#scrollable { width:%dpx; }\n", $thumbinfo[0]);
+$template = $theme->getTemplate();
-$inlinestyles .= <<themetype == 'horizontal') {
+ $inlinestyles = sprintf("\n#scrollable { width:%dpx; }\n", $thumbinfo[0]);
+} else {
+ $inlinestyles = sprintf("\n#scrollable { height:%dpx; }\n", $thumbinfo[0]);
}
-a:link {
- text-decoration: none;
-}
-a:visited {
- text-decoration: none;
-}
-a:hover {
- text-decoration: none;
-}
-a:active {
- text-decoration: none;
-}
-EOD;
$template->assign('scripts', $scripts);
$template->assign('styles', $styles);
@@ -86,9 +70,8 @@ $template->assign('thumbnails', getAllThumbnails($thumbinfo));
$template->assign('firstpreview', getFirstPreview($thumbinfo));
$template->assign('firstdescription', getFirstDescription($thumbinfo));
$template->assign('lang', 'de');
-$template->assign('themepath', 'themes/default_horizontal');
$template->assign('gallery', $gallery);
-$template->display('themes/default_horizontal/theme.php');
+$theme->display();
?>
\ No newline at end of file
diff --git a/themes/default_horizontal/theme.php b/themes/default_horizontal/theme.php
index 322d155..e1f5763 100644
--- a/themes/default_horizontal/theme.php
+++ b/themes/default_horizontal/theme.php
@@ -6,6 +6,22 @@