Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-15-2004, 06:25 PM   PM User | #1
ssskaya
Regular Coder

 
Join Date: Oct 2002
Location: USA
Posts: 255
Thanks: 1
Thanked 0 Times in 0 Posts
ssskaya is an unknown quantity at this point
Question can PHP be a solution?

my website is growing day by day with new pages.

I am not using any frames on it, and so I have to insert the same header, footer and the menu to each page.

when I am making a change it is becoming more of a trouble day by day - since I am not using a content management system like phpnuke or so.

is it possible that I write just one, shall we say, menu/header/footer script, and apply it to all pages by simply referencing to it?

can php do that?

if not, what else can you recommend?

thanks!
ssskaya is offline   Reply With Quote
Old 01-15-2004, 06:36 PM   PM User | #2
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
You can do this by using includes

example
header.php
PHP Code:
<html>
<
head>
<
title>Website name</title>
</
head>
<
body
footer.php
PHP Code:
<p>Footer text</p>
</
body>
</
html
index.php
PHP Code:
<?php
include("header.php");
?>
This text is now in the body
<?
include("footer.php");
?>
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 01-15-2004, 07:17 PM   PM User | #3
ssskaya
Regular Coder

 
Join Date: Oct 2002
Location: USA
Posts: 255
Thanks: 1
Thanked 0 Times in 0 Posts
ssskaya is an unknown quantity at this point
Thanks for the reply.

to give it a bit of depth:

I will put them in tables of a regular .html file.

So, if my menu.php file itself is actually a table with a width of 90%, will I have to make any modifications?

Thanks!
ssskaya is offline   Reply With Quote
Old 01-15-2004, 07:24 PM   PM User | #4
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
If your html was fine before, then you shouldn't have to change anything
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 01-15-2004, 07:25 PM   PM User | #5
ssskaya
Regular Coder

 
Join Date: Oct 2002
Location: USA
Posts: 255
Thanks: 1
Thanked 0 Times in 0 Posts
ssskaya is an unknown quantity at this point
Thanks a lot for your time.

One last question: is php the only option or could this be done by other term in html?

Thanks.
ssskaya is offline   Reply With Quote
Old 01-15-2004, 07:30 PM   PM User | #6
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
In html, you could use iframes, can't think of any other way
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 01-15-2004, 09:55 PM   PM User | #7
ssskaya
Regular Coder

 
Join Date: Oct 2002
Location: USA
Posts: 255
Thanks: 1
Thanked 0 Times in 0 Posts
ssskaya is an unknown quantity at this point
I did it all and it works great!

Thanks a lot!
ssskaya is offline   Reply With Quote
Old 01-16-2004, 05:00 AM   PM User | #8
Celtboy
Regular Coder

 
Join Date: May 2002
Location: Virginia, USA
Posts: 620
Thanks: 0
Thanked 6 Times in 6 Posts
Celtboy is an unknown quantity at this point
A non-php method = server side includes! (SSI):

<!--#include file="header.htm" //-->
Celtboy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:38 AM.


Advertisement
Log in to turn off these ads.