aboutsummaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2018-08-30 04:40:53 -0400
committerThedro Neely <thedroneely@gmail.com>2018-08-30 04:40:53 -0400
commit2659205908bd5cab508f4ff817123673e078ab74 (patch)
treee455f36b124e9b98f7005e6d4310b71881734623 /model
downloadedwinmattiacci.com-2659205908bd5cab508f4ff817123673e078ab74.tar.gz
edwinmattiacci.com-2659205908bd5cab508f4ff817123673e078ab74.tar.bz2
edwinmattiacci.com-2659205908bd5cab508f4ff817123673e078ab74.zip
Initialize Repo: First Commit
Diffstat (limited to 'model')
-rw-r--r--model/Form.php8
-rw-r--r--model/Navigator.php86
2 files changed, 94 insertions, 0 deletions
diff --git a/model/Form.php b/model/Form.php
new file mode 100644
index 0000000..2ed0d96
--- /dev/null
+++ b/model/Form.php
@@ -0,0 +1,8 @@
+<?php
+
+class Form
+{
+ public $name;
+ public $email;
+ public $message;
+}
diff --git a/model/Navigator.php b/model/Navigator.php
new file mode 100644
index 0000000..a8150e9
--- /dev/null
+++ b/model/Navigator.php
@@ -0,0 +1,86 @@
+<?php
+
+function navBar()
+{
+ switch ($_SERVER['REQUEST_URI']) {
+ case '/posts/':
+ $uri = $_SERVER['REQUEST_URI'];
+ $location = 'Posts ';
+ break;
+
+ case '/feedback/':
+ $uri = $_SERVER['REQUEST_URI'];
+ $location = 'Feedback ';
+ break;
+
+ case '/contact/':
+ $uri = $_SERVER['REQUEST_URI'];
+ $location = 'Contact ';
+ break;
+
+ case '/login/':
+ $uri = $_SERVER['REQUEST_URI'];
+ $location = 'Login ';
+ break;
+
+ default:
+ $uri = '/';
+ $location = 'Home ';
+ }
+
+ $navbar = [
+ $location => ['link' => $uri], //Hidden link shown in mobile responsive mode.
+ 'Home' => ['link' => '/'],
+ 'Posts' => ['link' => '/posts/'],
+ 'Feedback' => ['link' => '/feedback/'],
+ 'Contact' => ['link' => '/contact/'],
+ ];
+
+ foreach ($navbar as $title => $route) {
+ $append ='';
+
+ // Bad css coding results in this...
+ // Due to the strpos check method for which page is active,
+ // "Home" is always active because "/" is always in
+ // the request uri. Run a seperate check for the home
+ // page and continue with the looped check. Will refactor
+ // to make the exception the rule.
+
+ if ($title === 'Home') {
+ if ($route['link'] === $_SERVER['REQUEST_URI']) {
+ echo '<a class="active" href="/">Home</a>';
+ continue;
+ }
+ echo '<a href="/">Home</a>';
+ continue;
+ }
+
+ if ($title === $location && $route['link'] === $_SERVER['REQUEST_URI']) {
+ echo '<a style="cursor: default; pointer-events: none;" href="/">' . $location . '</a>';
+ continue;
+ }
+
+ if ($route['link'] === $_SERVER['REQUEST_URI'] || strpos($_SERVER['REQUEST_URI'], $route['link']) !== false) {
+ $append = 'class="active" ';
+ }
+ echo str_repeat("\t", 4) . '<a ' . $append . 'href="' . $route['link'] . '">' . $title . '</a>' . "\n";
+ }
+}
+
+function navBarPost()
+{
+ $navbar = [
+ 'Home' => ['uri' => '/'],
+ 'Posts' => ['uri' => '/posts/'],
+ 'Feedback' => ['uri' => '/feedback/'],
+ 'Contact' => ['uri' => '/contact/'],
+ ];
+
+ foreach ($navbar as $title => $route) {
+ $append ='';
+ if ($route['uri'] === $_SERVER['REQUEST_URI']) {
+ $append = 'class="active" ';
+ };
+ echo str_repeat("\t", 4) . '<a ' . $append . 'href="' . $route['uri'] . '" ' . 'onclick="closeNav()"' . '>' . $title . '</a>' . "\n";
+ }
+}