function defaultTemplate() { $this->readConfig("websites/www/config.php"); $url = "{$_SERVER['HTTP_HOST']}"; $domain = str_replace('www.', '', $this->extract_domain($url)) ?: 'www'; $sub_domain = str_replace('www.', '', $this->extract_subdomains($url)) ?: 'www'; $service_host = $this->getConfig('xepan-service-host', false); if ($service_host && $service_host !== $domain) { $epan = $domain; } else { $epan = $sub_domain; } $this->dbConnect(); $epan = $this->db->dsql()->table('epan')->where($this->db->dsql()->orExpr()->where('name', $epan)->where('aliases', 'like', '"%' . $epan . '%"'))->getHash(); // die(print_r($epan,true)); // die($epan['name']); $current_website = $this->current_website_name = $epan['name']; $this->readConfig("websites/{$this->current_website_name}/config.php"); $this->addLocation(array('page' => array("websites/{$current_website}/www"), 'js' => array("websites/{$current_website}/www/js"), 'css' => array("websites/{$current_website}/www", "websites/{$current_website}/www/css"), 'template' => ["websites/{$current_website}/www"], 'addons' => ['websites/' . $current_website . '/www']))->setParent($this->pathfinder->base_location); return parent::defaultTemplate(); }