DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

PHP Includes Help

By: | 18 Feb 2009 4:25 pm

Hello.

I`m new here and am trying to build a site using tables and php includes. My issue is this, I love the layout I have, but would like to have individual files consisting of header, sidebar and mainbody using my current layout. Problem is, every single tutorial I find on the web won`t tell me exactly how to render the page as is. I really want to get this figured out since I am building a rather large site where I`d like to have the multiple pages, but when I want to change the layout, I don`t want to have to go through and change every single page in the site. I want one accessable filed to change header layout and one for the sidebar as I`ll be adding stuff quite frequently.

My site layout is here:
http://tamara-braun.com/temp3.php <http://tamara-braun.com/temp3.php>

What I want is to separate it into the different files, but still keep
the table layout I have. Can anyone help me with this?

Thanks in advance.

Comments

What you are trying to do should be very simple. Just make the files with the code you want in them and include them in the page you are actually calling.

See example below:

top.php
<html>
<head><title>my top page</title></head>
<body>
-----------------------
footer.php

</body>
</html>
-----------------------
main.php
<?php
include(`top.php`);
The body goes here
include(`footer.php`);
?>
-----------------------

The code above would actually display the following to your browser:
<html>
<head><title>my top page</title></head>
<body>

The body goes here
</body>
</html>

By: | 18 Feb 2009

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move