php master page help

Status
Not open for further replies.

meghraj

Broken In
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

spice it up
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...
 

nasweef

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

meghraj

Broken In
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.
 
Status
Not open for further replies.
Top Bottom