public function render($template, $data = null) { //$mainTemplate - main template of the site; contents head tags, main menu, etc $mainTemplate = \Application\getConfig('main template'); //$template - template of single pages $template = $template . '.php'; if (is_array($data)) { extract($data); } include './Templates/' . $mainTemplate . '.php'; }
public static function getInstance() { $host = \Application\getConfig('host'); $database = \Application\getConfig('database'); $login = \Application\getConfig('login'); $pass = \Application\getConfig('pass'); if (!self::$instance) { self::$instance = new PDO("mysql:host={$host};dbname={$database}", $login, $pass); self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } return self::$instance; }
public function __construct() { //set the default values of controller and index $this->controller = \Application\getConfig('default controller'); $this->action = \Application\getConfig('default action'); }