/** * Instance all needed params for * all controllers */ public function __construct() { /** * instance app */ $this->slimApp = ConceptApp::boot()->app(); /** * Check if manager mode */ $this->managerPath = ConceptApp::boot()->isBackEnd(); /** * Set directory TPL */ $this->setTplDirectory(); /** * Set assets Url */ $this->setAssetsUrl(); /** * set default html var * namespaced by config */ $this->htmlVar['config']['site_url'] = Config::baseUrl(); $this->htmlVar['config']['assets_url'] = $this->assetsUrl; $this->htmlVar['config']['base_path'] = Config::basePath(); $this->htmlVar['config']['tplPath'] = $this->tplDirectory; $this->htmlVar['config']['manager'] = $this->managerPath; }
/** * Render all scripts or styles defined * in config.yml file * @param $mode * @return string */ public static function js($mode = 'scripts') { /** * Get all js or css in config.yml file */ $allResources = self::getConfigList($mode); /** * Check if $_registeredScript or * $_registeredStyles is not empty */ $pt = $mode == 'scripts' ? self::$_registeredScript : self::$_registeredStyles; if (sizeof($pt)) { foreach ($pt as $key => $val) { $allResources[$key] = $val; } } /** * get all raw script or styles */ if (sizeof(self::$raw)) { $sc = self::$raw; } /** * render */ foreach ($allResources as $resource) { $resource .= ConceptApp::boot()->app()->config('mode') == 'development' ? '?_=' . time() : ''; $sc[] = sprintf(self::$_patterns[$mode], self::assetsUrl() . $resource); } return implode("\n", $sc); }
<?php use App\Concept\ConceptApp; use App\Concept\Config; $conceptApp = ConceptApp::boot()->app(); require_once Config::basePath('src') . '/routes.php'; App::run();