en.opensuse.org

Break the page up

Go to page 1 2 3 4 5 6 7 8

The layout completed, I start with the breaking up of the page into parts that will stay the same and a part that will be different each time I load it. The part that changes is at this moment the text part. All the rest stays the same for each page. The main idea is to make adding extra pages as easy as possible, so I just devide the page in three parts. The first part is what comes before the text part. The second part is the text part and the third part is what comes after the text part.

I cut and paste the first part to a file called start.inc. On start.inc I just add <?php at the beginning of the file and ?> at the end of the file. As I have deleted something on the main test.php page, I must replace it. What I want it to have is what I have on that other page. I need to include that stuff, so I replace what I deleted with the following lines. You could do it on the same line. I just think it is easier to read:

<?php
include("start.inc");
?>

Next I test it. If you do not have it on your local machine, you must upload it to your provider. If you have worked with html files up till now, now you need to rename them to php. If you only see a blank page, you most likely have forgotten or misplaced something, like a ; or a ".

Next you do the same thing to the end part. This will give you 4 files. One css file, one start.inc, one end.inc and one php file that has all the things you actually need. To add extra pages, all you need to do is add real content into start.inc and end.inc, look at it and then safe the php as something like _deafult.php after removing the Lorem Ipsum parts.

This is how a page looks like:

<?php
include("start.inc");
?>
<H1>Main content</h1>
<p>Some blabla</p>
<?php
include("end.inc");
?>

To add extra pages, you just edit the content from _default.php and save it as any page you like. Don't forget to edit either start.inc or end.inc if there are e.g. links to the pages. You can do much more as explained on the next page.