I want to create a master page in php.
The scenario:
I have an index.php page which contains some banner at the top and a logo on the right top corner.
Now i create a new page named page1.php.
I want to make index.php as the masterpage and inherit all the content from index.php including the banner along with some content space in the page1.php.
page1.php must allow the content space to be edited.
So index.php is a masterpage.
Can someone send me the code for doing so and some more samples if possible.
Thnx in advanced.
Help me with master page
Moderator: General Moderators
Re: Help me with master page
Hi bis
You must just use include function with includes.
Here is example:
1. You have 1 php script wich you can call baner_top.inc.php
in baner_top.inc -> you can put html with your banner image.
2. Another script you can use for second include - logo.inc.php -> here you can put html with logo image.
3. index.php must inlclude these includes ( 1 and 2 ) on the right place:
With these scenario you can make page1.php, page2.php and etc. but in content you will fill what you need in these pages, and baner and logo will be the same as in index.php
You must just use include function with includes.
Here is example:
1. You have 1 php script wich you can call baner_top.inc.php
in baner_top.inc -> you can put html with your banner image.
2. Another script you can use for second include - logo.inc.php -> here you can put html with logo image.
3. index.php must inlclude these includes ( 1 and 2 ) on the right place:
Code: Select all
<html>
<body>
<?php
<!--here is baner_top-->
include "baner_top.inc.php"; // here you include your first include.
?>
here is some content of your index page.
<?php
<!--here is logo-->
include "logo.inc.php"; // here you include your first include.
?>
Here is another content of your index page.