Jump to content

Having to write the header, footer, menu code 20 times


crmamx

Recommended Posts

You probably know this story by now.

 

I had a web site that used html, frames and inline css. Basically speaking, using [base target=content], the header, footer and menu never moved. All I had to worry about in developing programs was the content.

 

I rewrote the site using php and external css and again I did not have to worry about the header, footer or menu, just the content.

 

Now I am writing a new site using just html and external css. No frames of course and I don't want to use php.

 

My problem is that in each program I have to include the code for the header, footer and menu as well as the content. Redundancy galore plus I am constantly changing the menu and consequently have to change 20 programs. The programs look like this:

 

<div id="container">
            <div id="header">
             </div>

            <div id="content">
</div>	

<div id="aside">
  	     <div id="menu">
     </div>
</div>

<div id="footer">
</div>
</div>

 

If I link to a program that brings in the header, footer and menu, then they are not in the proper sequence.

 

Without using frames or php, just html and css is there a way I can write the header, footer and menu just one time and reference it from my content program and have it in the right sequence?

Link to comment
Share on other sites

if i am honest i would just use a little snippet of php. and as far as frames i know of no other way to do what you want than including the header by using include. You need to save your file as .php ofcourse.

 

Just do inside your header:

 

<div id="header">
     <?php include 'header.php'; ?>
</div>

 

And footer

 

<div id="footer">
    <?php include 'footer.php'; ?>
</div>

 

if anyone else knows a way other than php or frames i love to hear it  ;D

Link to comment
Share on other sites

Yep, that is kind of what I had figured.

 

But I am getting totally confused. It is ok to use php in the programs I am using to develop the tutorial. I did not want to use them in any of my examples and I don't have to. There is where my confusion was.

 

But like I said before, sometimes I will get in my car and forget where I was going... :confused:

 

cssfreakie to the rescue!

 

Thanks pal....  ::)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.