Homepage (index.php) Code Example

Copy the code below:

<!DOCTYPE html>
<html lang="en">
<?php 
  $pageTitle = "Home Page"; 
  include 'includes/head.php'; 
?>
<body>

  <?php include 'includes/navbar.php'; ?>
  <?php include 'offcanvas.php'; ?>


  <?php
     $carouselImages = [
    [
        'src' => './images/slide1.jpg',
        'alt' => 'First slide',
        'caption' => 'Purple Circuit Background'
    ],
    [
        'src' => './images/slide2.jpg',
        'alt' => 'Second slide',
        'caption' => 'White Polygon Background'
    ],
    [
        'src' => './images/slide3.jpg',
        'alt' => 'Third slide',
        'caption' => 'Blue Background with White Dots'
    ],
   ];

   include 'includes/carousel.php';
  ?>


  <div class="container mt-5">
    <?php
      if (session_status() === PHP_SESSION_NONE) {
      session_start();
     }

      $username = !empty($_SESSION['username']) ? htmlspecialchars($_SESSION['username']) : 'Guest';
     ?>

	<h1><img src="images/8bitmckee.png" class="rounded" alt="8-bit version of Mr. Mckee's head" width="100" height="100">  Welcome <?= $username ?> to Mr. Mckee's Website!
	<img src="images/jscc_logo.png" class="rounded" alt="James Sprunt Community College logo" width="200" height="100"></h1>
	<p>This site was created for use in the Spring 2026 CTS-289 System Support Project course.<br><br>
	*This page has been coded to pull in the head, navbar, scripts, and carousel code using PHP includes.</p>
	<iframe width="157" height="288" src="https://www.youtube.com/embed/7dhvxRIZc4c" title="Mr. Mckee&#39;s Normal 9 to 5" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
    </iframe>
	

	</div>

  <?php include 'includes/scripts.php'; ?>
</body>
</html>