diff --git a/composer.lock b/composer.lock index 54d7f62..9b922a3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1672b0fbbe00eb53e9c4c59acb2706ca", + "content-hash": "80ee11d52c1489f117df24ff04e565e9", "packages": [], "packages-dev": [], "aliases": [], @@ -14,8 +14,10 @@ "prefer-lowest": false, "platform": { "php": ">=7.4", - "ext-mbstring": "*" + "ext-mbstring": "*", + "ext-libxml": "*", + "ext-dom": "*" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.6.0" } diff --git a/router/route.php b/router/route.php index d382b9d..65567fa 100644 --- a/router/route.php +++ b/router/route.php @@ -9,6 +9,10 @@ $router->get('/', function () { (new View)->display('/home'); }); + +$router->get('/helloworld', function () { + (new View)->renderHTML('

Hello World!

'); +}); $router->get('/home', [\Wepesi\Controller\indexController::class,'home']); // $router->post('/changelang', [indexController::class, 'changeLang']) diff --git a/src/Core/View.php b/src/Core/View.php index b0f6200..2573d26 100644 --- a/src/Core/View.php +++ b/src/Core/View.php @@ -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 * @@ -244,6 +252,14 @@ public function assign(string $variable, $value) $this->data[$variable] = $value; } + /** + * List all data assigned before being displayed + * @return array + */ + public function getAssignData(): array + { + return $this->data; + } /** * you should provide the extension of your file, * in another case the file will be missing @@ -273,4 +289,4 @@ public function resetConfig(){ $this->layout = ''; $this->folder_name = ''; } -} \ No newline at end of file +}