Skip to content

Commit

Permalink
Merge pull request #94 from kivudesign/version_boss
Browse files Browse the repository at this point in the history
[ENH] setup application layout to point into views folder.
  • Loading branch information
bim-g committed Jul 30, 2023
2 parents cc0292c + 67e527b commit 5acefc7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@

$app = new Application($ROOT_DIR, $configuration);

require_once Application::$ROOT_DIR . '/router/route.php';
require_once $app::$ROOT_DIR . '/router/route.php';

$app->run();
2 changes: 1 addition & 1 deletion src/Core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static function dumper($ex)
*/
public static function setLayout(string $layout)
{
self::$LAYOUT = $layout;
self::$LAYOUT = self::$ROOT_DIR.'/views/'.$layout;
}

/**
Expand Down
9 changes: 8 additions & 1 deletion src/Core/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ protected function renderLayout(string $view)
*/
private function buildAssetHead($html)
{
if(!$html){
throwException('Unable to render empty data');
}
$dom = new \DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML(
Expand Down Expand Up @@ -207,6 +210,10 @@ public function assign(string $variable, $value)
*/
public function setLayout(string $template)
{
$this->layout = $template;
$this->layout = Application::$ROOT_DIR . '/views/' . $template;
}

public function setLayoutContent(string $layout_name){
$this->layout_content = $layout_name;
}
}

0 comments on commit 5acefc7

Please sign in to comment.