Calling external HTML content with CSS (like iframes does)

Hello,
I tried to find a solution for this but nothing to answer what I need.

I have 3 HTML+CSS pages.
Let's call them "header, body and footer".

Header and Footer are unique files and ALWAYS keep intact.

There are many body files, with different content, but all them must call the HEADER and FOOTER.

Is it possible? How do I call them?

I was thinking in calling the header and footer like divs but the content come from header.html and footer.html

Thanks for any help!
fabianlujanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LZ1Commented:
If your trying to call files with CSS it cannot be done.  You'll need to call them within the "body" page with either PHP, HTML or your server language.  
We use PHP where I am at currently and one of our pages looks like this:
We have all of our normal header declarations in the header.php file. Like the CSS, Doctype, scripting, etc.  
Then comes the body and the content.  Then the rest of the includes.

<?php 
$title = "Here's our title";
$keywords= "Here are the keywords";
$description ="Description.";?>

<?php include ('includes/header.php'); ?>

BODY GOES HERE

<?php include ('includes/sidebar.php');?>                       
<?php include ('includes/footer.php'); ?>

Open in new window

0
fabianlujanAuthor Commented:
LZ1, how do I format a full HTML file in order to become php?
I have php on my server.

Ok, no calls from css but, every file (header, body and footer) are formatted using style.css so it will appear under that style, right?

Thanks!
0
LZ1Commented:
You don't have to use PHP, that was just an example.  You really don't need to format it.  I would only use PHP if you absolutely need it.  If your just doing a simple non-databased website then use HTML.  It'll be lighter weight on your server.
As long as you have the styles in your CSS they will format that way.  And the browsers will render them as if it were one big file.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

fabianlujanAuthor Commented:
OK, no need of php, but, how should I put the code (example) above into a HTML?

<?php include ('folder/footer.php');?> does the trick?

and the same for header?

thanks again :D
0
LZ1Commented:
If your running php then yes you could use the php include like you have above.  Otherwise you could just use this:
<!--#include virtual="insertthisfile.html" -->  
0
fabianlujanAuthor Commented:
will try and let you know LZ1 ;)
0
LZ1Commented:
I'm not going anywhere........yet.  ;)
0
fabianlujanAuthor Commented:
Hello LZ1,

Can't make them work fine.
Check the files by theirselves:

The body 'calling' the header and footer: http://www.marambio.aq/mainbody.html
The footer file: http://www.marambio.aq/footer.html
and the header file: http://www.marambio.aq/header.html

Thanks for your help!
0
LZ1Commented:
Try using this instead:
<?php include("http://www.marambio.aq/header.html"); ?>
<?php include("http://www.marambio.aq/footer.html"); ?>

 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LZ1Commented:
If the PHP doesn't work, save the header and footer files with an shtml extension and try it again the first way.
<!--#include file="http://www.marambio.aq/header.shtml" -->
 
0
fabianlujanAuthor Commented:
BINGO!

I works but, I have to figured out why I wasn't been able to see it working.

The mainbody file was being opened as .html instead of .php

Then, I saved the same file as php and it did the trick!

You got the solution my friend, thanks!

Last question...
What is the best practise when working with this kind of files?
Each of this trio have a full header with meta tags, etc.
Should I only have that within the "body" file and let the header/footer alone?

Thanks again!
0
LZ1Commented:
Well, as posted above:
The header should contain all the critical include files and house everything that goes in the head of the document.  
The footer is the same, except it should only contain everything that goes in the footer or at the end of the file.
The body of each page should be relevant to that page, with the header and footer includes above and below respectively.  Like above, you can also specify your keywords, title and meta tags if you'd like, but make sure you set your header file up for that.  
0
fabianlujanAuthor Commented:
Perfect!
LZ1 is truly an expert!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.