Part on Superglobals finished

This commit is contained in:
Patryk Hegenberg 2022-12-12 20:23:31 +01:00
parent c80327424b
commit a1e1a43d81
6 changed files with 19 additions and 4 deletions

View file

@ -1,3 +1,4 @@
<?php
require 'functions.php';
$heading = "About Us";
require "views/about.view.php";

View file

@ -1,3 +1,4 @@
<?php
require 'functions.php';
$heading = "Contact Us";
require "views/contact.view.php";

11
functions.php Normal file
View file

@ -0,0 +1,11 @@
<?php
function dd($value) {
echo "<pre>";
var_dump($value);
echo "</pre>";
die();
}
function urlIs($value) {
return $_SERVER['REQUEST_URI'] === $value;
}

View file

@ -1,3 +1,4 @@
<?php
require 'functions.php';
$heading = "Home";
require "views/index.view.php";

View file

@ -1,3 +1,4 @@
<?php
require 'functions.php';
$heading = "Mission";
require "views/mission.view.php";

View file

@ -8,13 +8,13 @@
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-4">
<!-- Current: "bg-gray-900 text-white", Default: "text-gray-300 hover:bg-gray-700 hover:text-white" -->
<a href="/" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Home</a>
<a href="/" class="<?= urlIs('/') ? 'bg-gray-900 text-white' : 'text-gray-300' ?> hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Home</a>
<a href="/about.php" class="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium" aria-current="page">About</a>
<a href="/about.php" class="<?= urlIs('/about.php') ? 'bg-gray-900 text-white' : 'text-gray-300' ?> hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium" >About</a>
<a href="/contact.php" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Contact</a>
<a href="/contact.php" class="<?= urlIs('/contact.php') ? 'bg-gray-900 text-white' : 'text-gray-300' ?> hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Contact</a>
<a href="/mission.php" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Our Mission</a>
<a href="/mission.php" class="<?= urlIs('/mission.php') ? 'bg-gray-900 text-white' : 'text-gray-300' ?> hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Our Mission</a>
</div>
</div>