Skip to content

Commit

Permalink
[ENH] make possible to render directly html text content without html…
Browse files Browse the repository at this point in the history
… page
  • Loading branch information
bim-g committed Apr 25, 2024
1 parent 13f3e5d commit bc5e327
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions router/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
$router->get('/', function () {
(new View)->display('/home');
});

$router->get('/helloworld', function () {
(new View)->renderHTML('<h1>Hello World!</h1>');
});
$router->get('/home', [\Wepesi\Controller\indexController::class,'home']);
//
$router->post('/changelang', [indexController::class, 'changeLang'])
Expand Down
8 changes: 8 additions & 0 deletions src/Core/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ protected function renderLayout(string $view)
}
}

/**
* render html string text
* @param string $html
* @return void
*/
public function renderHTML(string $html) {
print($html);
}
/**
* @param $html
*
Expand Down

0 comments on commit bc5e327

Please sign in to comment.