From e459366c464618a01b0666a4933f4b11ef7153c1 Mon Sep 17 00:00:00 2001 From: Ro Date: Sun, 28 Feb 2021 17:04:54 -0800 Subject: [PATCH] working out page routing --- brain/views/default/index.twig | 32 ++++++++++-------- dashboard.php | 33 ------------------- index.html | 1 - index.php | 59 ++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 48 deletions(-) delete mode 100644 dashboard.php delete mode 100644 index.html create mode 100644 index.php diff --git a/brain/views/default/index.twig b/brain/views/default/index.twig index 9a5eb45..2a5facd 100644 --- a/brain/views/default/index.twig +++ b/brain/views/default/index.twig @@ -1,22 +1,26 @@ - - - - {{ title }} - + + + + {{ title }} + - + -

- {{ name }} is a {{ occupation }} -

-
-
- {{folks}} has {{ secret }} -
+

+ {{ name }} + is a + {{ occupation }} +

+
+
+ {{ folks }} + has + {{ secret }} +
- + \ No newline at end of file diff --git a/dashboard.php b/dashboard.php deleted file mode 100644 index ff7916c..0000000 --- a/dashboard.php +++ /dev/null @@ -1,33 +0,0 @@ -add(TwigMiddleware::create($app, $twig)); - -//Dashboard Index -$app->get('/dashboard', function (Request $request, Response $response) { - $index = new IndexControl(); - $settings = new Settings(); - $folks = $settings->getFolks(); - $secret = $index->getSecret(); - $view = Twig::fromRequest($request); - - return $view->render($response, 'index.twig', [ - 'title' => 'This is Fipamo', - 'name' => 'Ro', - 'occupation'=>'pretty cool... I guess', - 'folks' => $folks[0]['handle'], - 'secret' => $secret - ]); -}); - -$app->run(); diff --git a/index.html b/index.html deleted file mode 100644 index b78e708..0000000 --- a/index.html +++ /dev/null @@ -1 +0,0 @@ -This is the index \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..304dcb0 --- /dev/null +++ b/index.php @@ -0,0 +1,59 @@ +add(TwigMiddleware::create($app, $twig)); + +//Index +$app->get('/[{first}[/{second}]]', function (Request $request, Response $response, array $args) { + + if(isset($args['first'])) + { + $first = $args['first']; + if(is_numeric($first)) + { + $response->getBody()->write("FIND A PAGE, B!"); + }else{ + $response->getBody()->write("This is the dash, brah!"); + }; + }else{ + $response->getBody()->write("No Params, Homie!"); + } + + if(isset($args['second'])) + { + $year = $args['second']; + }; + + + return $response; +}); + +//Dashboard Index +/** +$app->get('/@/dashboard', function (Request $request, Response $response) { + $index = new IndexControl(); + $settings = new Settings(); + $folks = $settings->getFolks(); + $secret = $index->getSecret(); + $view = Twig::fromRequest($request); + + return $view->render($response, 'index.twig', [ + 'title' => 'This is Fipamo', + 'name' => 'Ro', + 'occupation'=>'pretty cool... I guess', + 'folks' => $folks[0]['handle'], + 'secret' => $secret + ]); +}); +**/ +$app->run(); \ No newline at end of file