From 75a329ec022ef21019afb17aecf776a10083e0cb Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Sun, 22 Jul 2007 05:49:09 +0000 Subject: [PATCH 1/1] issue61, theme support git-svn-id: file:///var/lib/svn/phpfspot/trunk@237 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- phpfspot.class.php | 1 + phpfspot_cfg.php.dist | 5 +++++ phpfspot_tmpl.php | 7 ++++++- stylesheet.css => themes/default/stylesheet.css | 0 {templates => themes/default/templates}/calendar.tpl | 0 {templates => themes/default/templates}/credits.tpl | 0 {templates => themes/default/templates}/export.tpl | 0 {templates => themes/default/templates}/footer.tpl | 0 {templates => themes/default/templates}/header.tpl | 2 +- {templates => themes/default/templates}/index.tpl | 0 {templates => themes/default/templates}/photo_index.tpl | 0 {templates => themes/default/templates}/search.tpl | 0 {templates => themes/default/templates}/single_photo.tpl | 0 {templates => themes/default/templates}/slideshow.tpl | 0 {templates => themes/default/templates}/tags.tpl | 0 {templates => themes/default/templates}/welcome.tpl | 0 16 files changed, 13 insertions(+), 2 deletions(-) rename stylesheet.css => themes/default/stylesheet.css (100%) rename {templates => themes/default/templates}/calendar.tpl (100%) rename {templates => themes/default/templates}/credits.tpl (100%) rename {templates => themes/default/templates}/export.tpl (100%) rename {templates => themes/default/templates}/footer.tpl (100%) rename {templates => themes/default/templates}/header.tpl (89%) rename {templates => themes/default/templates}/index.tpl (100%) rename {templates => themes/default/templates}/photo_index.tpl (100%) rename {templates => themes/default/templates}/search.tpl (100%) rename {templates => themes/default/templates}/single_photo.tpl (100%) rename {templates => themes/default/templates}/slideshow.tpl (100%) rename {templates => themes/default/templates}/tags.tpl (100%) rename {templates => themes/default/templates}/welcome.tpl (100%) diff --git a/phpfspot.class.php b/phpfspot.class.php index 23eb541..825f92d 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -150,6 +150,7 @@ class PHPFSPOT { $this->tmpl->assign('to_date', $this->get_calendar('to')); $this->tmpl->assign('sort_field', $this->get_sort_field()); $this->tmpl->assign('content_page', 'welcome.tpl'); + $this->tmpl->assign('template_path', 'themes/'. $this->cfg->theme_name); $this->tmpl->show("index.tpl"); diff --git a/phpfspot_cfg.php.dist b/phpfspot_cfg.php.dist index adbe0da..07795c6 100644 --- a/phpfspot_cfg.php.dist +++ b/phpfspot_cfg.php.dist @@ -32,6 +32,8 @@ class PHPFSPOT_CFG { var $web_path = "/phpfspot"; + var $theme_name = "default"; + /* it's enough if this database is readonly for the webserver */ var $fspot_db = "/var/www/f-spot-dbs/photos.db"; @@ -114,6 +116,9 @@ class PHPFSPOT_CFG { if(!isset($this->hide_tags)) $this->showError("Please set \$hide_tags in phpfspot_cfg"); + if(!isset($this->theme_name)) + $this->showError("Please set \$theme_name in phpfspot_cfg"); + if(isset($this->error_found) && $this->error_found) exit(1); diff --git a/phpfspot_tmpl.php b/phpfspot_tmpl.php index 9609477..996ff44 100644 --- a/phpfspot_tmpl.php +++ b/phpfspot_tmpl.php @@ -29,8 +29,13 @@ class PHPFSPOT_TMPL extends Smarty { public function __construct($parent) { + if(!file_exists($parent->cfg->base_path .'/themes/'. $parent->cfg->theme_name .'/templates')) { + print "No templates found in ". $parent->cfg->base_path .'/themes/'. $parent->cfg->theme_name .'/templates'; + exit(1); + } + $this->Smarty(); - $this->template_dir = $parent->cfg->base_path .'/templates'; + $this->template_dir = $parent->cfg->base_path .'/themes/'. $parent->cfg->theme_name .'/templates'; $this->compile_dir = $parent->cfg->base_path .'/templates_c'; $this->config_dir = $parent->cfg->base_path .'/smarty_config'; $this->cache_dir = $parent->cfg->base_path .'/smarty_cache'; diff --git a/stylesheet.css b/themes/default/stylesheet.css similarity index 100% rename from stylesheet.css rename to themes/default/stylesheet.css diff --git a/templates/calendar.tpl b/themes/default/templates/calendar.tpl similarity index 100% rename from templates/calendar.tpl rename to themes/default/templates/calendar.tpl diff --git a/templates/credits.tpl b/themes/default/templates/credits.tpl similarity index 100% rename from templates/credits.tpl rename to themes/default/templates/credits.tpl diff --git a/templates/export.tpl b/themes/default/templates/export.tpl similarity index 100% rename from templates/export.tpl rename to themes/default/templates/export.tpl diff --git a/templates/footer.tpl b/themes/default/templates/footer.tpl similarity index 100% rename from templates/footer.tpl rename to themes/default/templates/footer.tpl diff --git a/templates/header.tpl b/themes/default/templates/header.tpl similarity index 89% rename from templates/header.tpl rename to themes/default/templates/header.tpl index acef8eb..5d66f2d 100644 --- a/templates/header.tpl +++ b/themes/default/templates/header.tpl @@ -3,7 +3,7 @@ {$page_title} - + diff --git a/templates/index.tpl b/themes/default/templates/index.tpl similarity index 100% rename from templates/index.tpl rename to themes/default/templates/index.tpl diff --git a/templates/photo_index.tpl b/themes/default/templates/photo_index.tpl similarity index 100% rename from templates/photo_index.tpl rename to themes/default/templates/photo_index.tpl diff --git a/templates/search.tpl b/themes/default/templates/search.tpl similarity index 100% rename from templates/search.tpl rename to themes/default/templates/search.tpl diff --git a/templates/single_photo.tpl b/themes/default/templates/single_photo.tpl similarity index 100% rename from templates/single_photo.tpl rename to themes/default/templates/single_photo.tpl diff --git a/templates/slideshow.tpl b/themes/default/templates/slideshow.tpl similarity index 100% rename from templates/slideshow.tpl rename to themes/default/templates/slideshow.tpl diff --git a/templates/tags.tpl b/themes/default/templates/tags.tpl similarity index 100% rename from templates/tags.tpl rename to themes/default/templates/tags.tpl diff --git a/templates/welcome.tpl b/themes/default/templates/welcome.tpl similarity index 100% rename from templates/welcome.tpl rename to themes/default/templates/welcome.tpl -- 2.25.1