href="../../../PHPForBeginners/index.php"
this should be
href="/"
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Source: PHP for Beginners, Season: Dynamic Websites, Episode PHP Partials.
I can't bind html href links like Jeff did in the Video.
Mine looks like this but still doesn't work. I tried various schemes, went to w3Schools, StackOverflow but nothing helped me. I am in deep frustration and don't know anymore.
Here is a snapshot of the nav.php:
<a href="../../../PHPForBeginners/index.php"
class="rounded-md bg-gray-900 px-3 py-2 text-sm font-medium text-white"
aria-current="page">Home</a>
<a href="/about.php"
class="rounded-md px-3 py-2 text-sm font-medium text-gray-300 hover:bg-gray-700 hover:text-white">About
Us</a>
<a href="/contact.php"
class="rounded-md px-3 py-2 text-sm font-medium text-gray-300 hover:bg-gray-700 hover:text-white">Contact</a>
<a href="/mission.php"
class="rounded-md px-3 py-2 text-sm font-medium text-gray-300 hover:bg-gray-700 hover:text-white">Our Mission</a>
PS: there is a div over it but when I put it up, the whole code disappears. I don't know why.
How are you running your server? Are you using this like Jeff did:
php -S localhost:8888
I think your folder structure is this: PHPForBeginners/view/partials/nav.php
I think you are running the server from the partials folder. You should run the server from the root of your project - PHPForBeginners folder.
Then everything will work like in the lesson.
Please or to participate in this conversation.