# php master page help



## meghraj (Apr 18, 2009)

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)

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 (Apr 19, 2009)

Use CSS.


----------



## nasweef (Apr 19, 2009)

you could create three different php files for menu,header and footer and include it wherever you need it.


----------



## meghraj (Apr 20, 2009)

kapsicum said:


> 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
> ...



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


----------

