register PHPFSPOT as global variable instead hand-over via classes
[phpfspot.git] / phpfspot_tmpl.php
1 <?php
2
3 /***************************************************************************
4  *
5  * phpfspot, presents your F-Spot photo collection in Web browsers.
6  *
7  * Copyright (c) by Andreas Unterkircher
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  ***************************************************************************/
24
25 class PHPFSPOT_TMPL extends Smarty {
26
27    public function __construct()
28    {
29       global $phpfspot;
30
31       if(!file_exists($phpfspot->cfg->base_path .'/themes/'. $phpfspot->cfg->theme_name .'/templates')) {
32          print "No templates found in ". $phpfspot->cfg->base_path .'/themes/'. $phpfspot->cfg->theme_name .'/templates';
33          exit(1);
34       }
35
36       $this->Smarty();
37       $this->template_dir = $phpfspot->cfg->base_path .'/themes/'. $phpfspot->cfg->theme_name .'/templates';
38       $this->compile_dir  = $phpfspot->cfg->base_path .'/templates_c';
39       $this->config_dir   = $phpfspot->cfg->base_path .'/smarty_config';
40       $this->cache_dir    = $phpfspot->cfg->base_path .'/smarty_cache';
41
42       if(isset($phpfspot->cfg->use_lightbox) && $phpfspot->cfg->use_lightbox == true)
43          $this->assign('use_lightbox', 'true');
44       if(isset($phpfspot->cfg->use_autocomplete) && $phpfspot->cfg->use_autocomplete == true)
45          $this->assign('use_autocomplete', 'true');
46
47    } // __construct()
48
49    public function show($template)
50    {
51       $this->display($template);
52
53    } // show()
54
55 }
56
57 ?>