issue61, theme support
authorAndreas Unterkircher <unki@netshadow.at>
Sun, 22 Jul 2007 05:49:09 +0000 (05:49 +0000)
committerAndreas Unterkircher <unki@netshadow.at>
Sun, 22 Jul 2007 05:49:09 +0000 (05:49 +0000)
git-svn-id: file:///var/lib/svn/phpfspot/trunk@237 fa6a889d-dae6-447d-9e79-4ba9a3039384

16 files changed:
phpfspot.class.php
phpfspot_cfg.php.dist
phpfspot_tmpl.php
themes/default/stylesheet.css [moved from stylesheet.css with 100% similarity]
themes/default/templates/calendar.tpl [moved from templates/calendar.tpl with 100% similarity]
themes/default/templates/credits.tpl [moved from templates/credits.tpl with 100% similarity]
themes/default/templates/export.tpl [moved from templates/export.tpl with 100% similarity]
themes/default/templates/footer.tpl [moved from templates/footer.tpl with 100% similarity]
themes/default/templates/header.tpl [moved from templates/header.tpl with 89% similarity]
themes/default/templates/index.tpl [moved from templates/index.tpl with 100% similarity]
themes/default/templates/photo_index.tpl [moved from templates/photo_index.tpl with 100% similarity]
themes/default/templates/search.tpl [moved from templates/search.tpl with 100% similarity]
themes/default/templates/single_photo.tpl [moved from templates/single_photo.tpl with 100% similarity]
themes/default/templates/slideshow.tpl [moved from templates/slideshow.tpl with 100% similarity]
themes/default/templates/tags.tpl [moved from templates/tags.tpl with 100% similarity]
themes/default/templates/welcome.tpl [moved from templates/welcome.tpl with 100% similarity]

index 23eb541c337d451e516a635d79ec964381a4ca73..825f92d098d55a8e602ee8c16bd5cf027ac89b31 100644 (file)
@@ -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");
 
 
index adbe0daf9dc3587bf20379966e00cfd56a89f054..07795c64e3d110cc4ad60266d31d1f9b92dad5e1 100644 (file)
@@ -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);
 
index 9609477f0b7cbcaf06dbd5ce15213ddc2afe3d43..996ff443d0a17076d8cb8251e933d6e9b282be30 100644 (file)
@@ -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';
similarity index 100%
rename from stylesheet.css
rename to themes/default/stylesheet.css
similarity index 89%
rename from templates/header.tpl
rename to themes/default/templates/header.tpl
index acef8eb8eae31c4a186268e84705fc9e22a018c0..5d66f2d38ff97d45f2d91e85513f74539194d9d6 100644 (file)
@@ -3,7 +3,7 @@
  <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>{$page_title}</title>
-  <link href="stylesheet.css" type="text/css" rel="stylesheet" />
+  <link href="{$template_path}/stylesheet.css" type="text/css" rel="stylesheet" />
   <script type="text/javascript" src="rpc.php?mode=init&amp;client=all"></script>
   <script type="text/javascript" src="phpfspot.js"></script>
   <link rel="shortcut icon" href="resources/gpl_16.png" type="image/png" />