diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/class/art2.php | 8 | ||||
-rw-r--r-- | app/class/config.php | 2 | ||||
-rw-r--r-- | app/class/controller.php | 4 | ||||
-rw-r--r-- | app/class/routes.php | 2 | ||||
-rw-r--r-- | app/view/templates/navart.php | 6 |
5 files changed, 13 insertions, 9 deletions
diff --git a/app/class/art2.php b/app/class/art2.php index 867b17a..3ba23cb 100644 --- a/app/class/art2.php +++ b/app/class/art2.php @@ -44,14 +44,14 @@ class Art2 // _____________________________________________________ F U N ____________________________________________________ - public function __construct($donnees) + public function __construct($datas = []) { - $this->hydrate($donnees); + $this->hydrate($datas); } - public function hydrate($donnees) + public function hydrate($datas) { - foreach ($donnees as $key => $value) { + foreach ($datas as $key => $value) { $method = 'set' . $key; if (method_exists($this, $method)) { diff --git a/app/class/config.php b/app/class/config.php index 495c008..83982de 100644 --- a/app/class/config.php +++ b/app/class/config.php @@ -63,7 +63,7 @@ abstract class Config public static function checkbasepath() { - $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . self::basepath() . Model::CONFIG_FILE; + $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . self::basepath() . DIRECTORY_SEPARATOR . Model::CONFIG_FILE; return (file_exists($path)); } diff --git a/app/class/controller.php b/app/class/controller.php index c8c620e..afeefb0 100644 --- a/app/class/controller.php +++ b/app/class/controller.php @@ -23,7 +23,11 @@ class Controller public function initplates() { + $router = $this->router; $this->plates = new League\Plates\Engine(Model::TEMPLATES_DIR); + $this->plates->registerFunction('url', function (string $string, array $vars = []) use ($router) { + return $router->generate($string, $vars); + }); } public function useriseditor() diff --git a/app/class/routes.php b/app/class/routes.php index f24492b..bd9fd71 100644 --- a/app/class/routes.php +++ b/app/class/routes.php @@ -9,7 +9,7 @@ class Routes public function match() { $router = new AltoRouter(); - $router->setBasePath(Config::basepath()); + $router->setBasePath('/' . Config::basepath()); $router->addRoutes([ ['GET|POST', '/', 'Backrouter#run', 'backrouter'], ['GET', '/[a:art]/', 'Controllerart#read', 'artread/'], diff --git a/app/view/templates/navart.php b/app/view/templates/navart.php index 469139d..6f4388c 100644 --- a/app/view/templates/navart.php +++ b/app/view/templates/navart.php @@ -26,7 +26,7 @@ div#dropmenu { <ul> <li> - <a class="button" href="./">home</a> + <a class="button" href="<?= $this->url('backrouter') ?>">home</a> </li> @@ -53,10 +53,10 @@ div#dropmenu { <?php if($user->canedit() && $artexist) { ?> <li> - <a class="button" href="<?= $router->generate('artread/', ['art' => $art->id()]) ?>" target="_blank">display</a> + <a class="button" href="<?= $this->url('artread/', ['art' => $art->id()]) ?>" target="_blank">display</a> </li> <li> - <a class="button" href="<?= $router->generate('artedit/', ['art' => $art->id()]) ?>" >edit</a> + <a class="button" href="<?= $this->url('artedit/', ['art' => $art->id()]) ?>" >edit</a> </li> <?php } ?> |