2 /***************************************************************************
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
11 * Copyright (C) 2009 Jonas Häggqvist
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
27 public function __construct($smartydir) {
28 /* Load and set up Smarty */
29 require_once(sprintf("%s/Smarty.class.php", $smartydir));
31 $s->template_dir
= sprintf("%s/templates", preconfig
::privpath
);
32 $s->compile_dir
= sprintf("%s/compiled", $s->template_dir
);
33 $s->cache_dir
= sprintf("%s/cache", $s->template_dir
);
35 $s->debugging
= false;
37 $s->security_settings
['IF_FUNCS'] = array('array_key_exists', 'isset', 'is_array', 'count');
38 $s->secure_dir
= array(
44 public function assign($name, $value) {
45 $this->s
->assign($name, $value);
48 public function render($pagename, $vars = array()) {
49 if (is_array($vars)) {
50 foreach($vars as $name => $value) {
51 $this->assign($name, $value);
54 $this->s
->display($pagename);
55 /* printf("<xmp>"); print_r($vars); print("</xmp>"); */