DIGIT-ARC read-only archive · snapshot: July 23, 2026

php master page help

5 posts · originally from https://geek.digit.in/community/threads/php-master-page-help.113152/

M
meghraj Original post #1
Apr 18, 2009 at 6:30 PM
I have start learning php recently and now I am creating a website for my friends project and the basic problem I faced is that php doesnot have masterpage option so how can I reflect menu and heder and footer in all those pages please help.
kapsicum
Apr 19, 2009 at 12:20 AM
php is not so sophisticated like may be dotNet whic gven u the easy facility of master page ... but you can do it in similar way haveing index.php kindda page ... where you have your static pages like Header, Menu & Footer while leaving a section of Middle pages which are dynamic based on the parameters or query string u set in the browser URL ...
basically u can have a switch case for middle section which decides what page to include in the middle section based on a single variable set by you in the URL.. like
www.yourdomain.com/index.php?pg=home
OR
www.yourdomain.com/index.php?pg=contact
OR
www.yourdomain.com/index.php?pg=faq
and so on ...
where u are using the variable $_GET['pg'] in switch case to include the respective middle pages....
this is very common way to implement a master page kind of in php...

Let me know if you need more clarifications...
Kl@w-24
Kl@w-24 #3
Apr 19, 2009 at 12:28 AM
Use CSS.
N
nasweef #4
Apr 19, 2009 at 12:53 PM
you could create three different php files for menu,header and footer and include it wherever you need it.
M
meghraj #5
Apr 20, 2009 at 1:39 PM
php is not so sophisticated like may be dotNet whic gven u the easy facility of master page ... but you can do it in similar way haveing index.php kindda page ... where you have your static pages like Header, Menu & Footer while leaving a section of Middle pages which are dynamic based on the parameters or query string u set in the browser URL ...
basically u can have a switch case for middle section which decides what page to include in the middle section based on a single variable set by you in the URL.. like
www.yourdomain.com/index.php?pg=home
OR
www.yourdomain.com/index.php?pg=contact
OR
www.yourdomain.com/index.php?pg=faq
and so on ...
where u are using the variable $_GET['pg'] in switch case to include the respective middle pages....
this is very common way to implement a master page kind of in php...

Let me know if you need more clarifications...

I thanks for giving me such detail about it but can you please provide tutorial for this...for better understanding.