[HTML/PHP] Including a content box after preoducing the HTML

Associate
Joined
18 Nov 2008
Posts
2,430
Location
Liverpool
EDIT: Examples are not operated for all browsers, recommend you view in Opera / Firefox!

Okay so I've been designing a user control panel for people using my gaming server, and have hit a problem. The way I have made it is that every .php page calls the function Layout from layout.inc, which then prints a consistent layout on each page. (Layout: http://www.redgies-rp.co.uk/redgie/test/).

Now I've come to start coding around the design, but the problem is, once I have ran the include, and it creates the design, I want it to have something in the middle, but when I create it, it is created at the bottom (Example: http://ucp.redgies-rp.co.uk/login.php).

Is there a solution to this? Or will I have to:
A) Re-Print the layout on every HTML document, rather than calling it from a remote location
B) Run everything of one file, index.php, and have all coding in the one file for all 20-30 pages, in the format of /index.php?page=pageid

Sorry if that makes no sense ^^

Much Appreciated!
 
are you talking about using the design as a 'wrapper' for each page?
if so, why not have a 'head' include which has the code up to the start of the middle content then a foot include which has the code from the end of the content to the </html> tag.
Get me?
then, each page would be something like:
<?php include("head.php"); ?>
Page stuff here....
<?php include("foot.php"); ?>

edit: you can have variable placeholders for things like the page title by the way and just set it before you call your include ;-)
 
I've just changed it so the right hand section is called last, but now it looks like this: http://ucp.redgies-rp.co.uk/login.php

Problem is the div tags are all inside of eachother, I guess that's going to be a problem...

EDIT: never mind I think I've got it, by leaving the .inc files open ended, the div tags carry over between files, I'll never stop being surprised by the power of web design ^^

Thanks a lot guys!
 
Last edited:
Yeah thanks after reading your post I was sat in college dieing for the lesson to end so I should come home and fix it! Thanks mate :)
 
Back
Top Bottom