I’m working on a website and I want to change the page contents when a user selects which page they want to navigate to. What I’m trying to accomplish would be like ASP.NET where you have only 1 navigation component that is used across all pages and the content of the page changes when a user selects a different page. How would I be able to accomplish this if I’m building a website with HTML/CSS and PHP. Any information I’m getting is how to change page content dynamically from PHP. I want to change the page content from other files in my directory
>Solution :
You can use PHP include function to control elements from only one file
write this in your index.php
and in header.php write the code like
<header>
...
</header>
and you could add css, javascript, jquery resource files into index.php
And advantage of include code is when visitor look at your page source or developer tools’ source it will appear as your header.php file not php include line.