Assuming that i have 4 pages in trial folder
I am using a xampp server to run these file and the url that shows when i run the code is http:// localhost/TRIAL/ which redirects to the index.php page. Is there any way for me to insert the other page(home.php,about.php,contact.php) to the index.php page when i click on the navigation buttons so that the file name of the pages that are open will not be shown? I would like to know if there are any ather way so that the link will remain to be http:// localhost/TRIAL/ instead of the http://localhost/TRIAL/about.php.
You can have the navigation buttons trigger a jQuery load() event.
<nav>
<ul>
<li><a href="#" id="nav-home">Home</a></li>
<li><a href="#" id="nav-about">About</a></li>
</ul>
</nav>
<script>
$(document).ready(function() {
$('#nav-home').click(function() {
$('#content').load('about.php');
return false;
});
});
</script>
<div id="content"></div>
Hope that helps
What you are looking for is include.
<?php
//Contents of Index Page
//Include Files
include './home.php';
include './about.php';
include './contact.php';
?>
The './' is used to include the files in the same sub directory as the index.php