How to do master paging in PHP
In this tutorial, I show how to do master paging in PHP.With the help of master paging, you can call numbers pages in one page or index page.
Steps to do Master Paging :
- First create folder `master` in www directory.In master folder, Create one folder`Pages` and create one new file, copy the following code and Save it as index.php.
<div style="width:100%;height:100px;border:solid 2px black;text-align:center;font-size:30px;">
<a href="index.php?page=home">HOME</a>
<a href="index.php?page=about">ABOUT</a>
</div>
<div style="width:100%;height:400px;border:solid 2px black;">
<?php
if(isset($_GET['page']))
{
$page_name=$_GET['page'];
include("pages/".$page_name.".php");
}
else
{
include("pages/home.php");
}
?>
</div>
- Create two files in `pages folder`.`Home` page and `About` page.
- For `home` page,copy the following and save it as home.php.
<h1 align="center"> This is home page.</h1>
<h1 align="center">This is about us page.</h1>
![]() |
Master paging screenshot -1 |
![]() |
Master paging screenshot -2 |
{[['
']]}
No comments