Concept of how to work with DooFramework
Ok in this article I will show you how should you work with DooFramework, when I am making website I like to have one super class that extends DooController class and in constructor of that class I will add all stuff needed for my application, so lets make that class, we should name it for example CoreController
<?php
class CoreController extends DooController {
/**
* Current URL
*/
protected static $_currentUrl = null;
/**
* Instance of Doo::db
*/
protected $_db = null;
/**
* Translator
*/
protected $_translate = null;
/**
* Instance of Doo::cache
*/
protected $_cache = null;
/**
* Base path of application
*/
public $_basePath = null;
/**
* Instace of DooSession
*/
public $_session = null;
/**
* Instance of DooAcl
*/
public $_acl = null;
/**
* Host
*/
public $host = null;
/**
* Js path
*/
public $jsPath = null;
public function __construct() {
$this->_basePath = Doo::conf()->ROOT_DIR;
// add some globals that we need
$this->_db = Doo::db();
$this->_view = DooController::view();
$this->host = Doo::conf()->host;
$this->_view->host = Doo::conf()->host;
// ACL
$this->_acl = Doo::acl();
// add sessions
$this->_session = Doo::session("mywebsite");
$templateVariables = $this->getSettings();
// session
$this->_view->_session = $this->_session;
$this->_cache = Doo::cache('apc');
$this->jsPath = $this->_view->host . 'static/js/';
}
/**
* Before run method
*/
public
More »

