private function __construct() { $this->smarty = new Smarty(); $this->smarty->setTemplateDir(Cfg::i()->tplroot); $this->smarty->setCompileDir(Cfg::i()->dirroot . DIRECTORY_SEPARATOR . 'cache'); $this->tpl = new StdClass(); }
public static function i() { if (self::$i == NULL) { self::$i = new Cfg(); } return self::$i; }
protected function assign() { $this->tpl->theme = Cfg::i()->theme_www; $this->tpl->path_forms = Cfg::i()->formroot; $this->requireJs(array("thirdparty/jquery.min", "thirdparty/preloader", "thirdparty/bootstrap.min", "thirdparty/tabcordion", "thirdparty/form", "thirdparty/bootstrap-select.min", "thirdparty/Sortable", "thirdparty/Ply.min", "app", "https://yandex.st/highlightjs/7.5/highlight.min.js")); $this->requireCss(array("https://fonts.googleapis.com/css?family=Fira+Sans", "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css", "thirdparty/bootstrap.min", "mac", "thirdparty/bootstrap-select.min", "main")); foreach ($this->tpl as $key => $value) { Tpl::i()->assign($key, $value); } }
protected function assign() { $this->tpl->USER = User::me(); $this->tpl->url = $this->requestUrl(); $this->tpl->theme = Cfg::i()->theme_www; $this->tpl->path_forms = Cfg::i()->formroot; $this->requireJs(array("thirdparty/jQuery-2.1.4.min", "https://code.jquery.com/ui/1.11.4/jquery-ui.min.js", "thirdparty/bootstrap.min", "https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js", "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js", "plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min", "plugins/slimScroll/jquery.slimscroll.min", "app", "app.min", "thirdparty/form", "demo", "schedule")); $this->requireCss(array("https://fonts.googleapis.com/css?family=Fira+Sans", "https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css", "thirdparty/bootstrap.min", "thirdparty/_all-skins.min", "thirdparty/AdminLTE", "_main", "_schedule-table")); foreach ($this->tpl as $key => $value) { Tpl::i()->assign($key, $value); } }
private function __construct() { $this->smarty = new Smarty(); $this->smarty->setTemplateDir(Cfg::i()->tplroot); $this->smarty->setCompileDir(Cfg::i()->cacheroot); }
<?php //db::i()->getRecords('user') // Сделать метод require_once "engine/cfg.php"; require_once "engine/db.php"; require_once "engine/tpl.php"; require_once "thirdparty/Smarty/Smarty.class.php"; Cfg::i(); $db = db::i(); $st = $db->_db->query("SELECT * FROM user", PDO::FETCH_ASSOC); $st->fetch(); $row = $db->_db->query("SET NAMES 'utf-8'");
<?php error_reporting(E_ALL); require_once "engine/cfg.php"; require_once "thirdparty/Smarty/Smarty.class.php"; define('DIRECT', false); spl_autoload_register(function ($class) { $path = Cfg::i()->dirroot . DS . 'engine' . DS . $class . ".php"; $arr_dir = array("engine", "app" . DS . "pages", "app" . DS . "classes", "app" . DS . "forms"); while (!class_exists($class) && !empty($arr_dir)) { $path = Cfg::i()->dirroot . DS . array_shift($arr_dir) . DS . $class . ".php"; if (file_exists($path)) { require_once $path; } } });