integrating/calling multiple files into one

D

Daniel

Hello,

Typically, I have create simple html webpages from start to finish,
everything in one html document.

I am now creating more complexe pages, and wish to compartmentalize
certain aspects. For example, the nav bar get generated by a separate
program which generate and html file, css, js.... I then call it
within my main doc. However, by doing so I end up with duplication of
head section, body.... and I assume this is not proper. The other
alternative is to copy and paste the various element of the nav bar
(styles, scripts, html) and the paste them in their respective zones.
this however, is very conterproductive as when a change need to be
made I must manually update each webpage (long and prone to errors).

What is the proper approach to doing this type of referencing multiple
docs into one.

Thank you for your experience and guidance,

Daniel
 
B

Bone Ur

Well bust mah britches and call me cheeky, on Thu, 01 Nov 2007 20:19:15 GMT
Daniel scribed:
Hello,

Typically, I have create simple html webpages from start to finish,
everything in one html document.

I am now creating more complexe pages, and wish to compartmentalize
certain aspects. For example, the nav bar get generated by a separate
program which generate and html file, css, js.... I then call it
within my main doc. However, by doing so I end up with duplication of
head section, body.... and I assume this is not proper. The other
alternative is to copy and paste the various element of the nav bar
(styles, scripts, html) and the paste them in their respective zones.
this however, is very conterproductive as when a change need to be
made I must manually update each webpage (long and prone to errors).

What is the proper approach to doing this type of referencing multiple
docs into one.

Thank you for your experience and guidance,

The best thing to do is use server-side scripting such as php. SSIs are
also an option. Scripting allows you to variablize and include sections of
text, html, etc.
 
D

Daniel

Well bust mah britches and call me cheeky, on Thu, 01 Nov 2007 20:19:15 GMT
Daniel scribed:










The best thing to do is use server-side scripting such as php. SSIs are
also an option. Scripting allows you to variablize and include sections of
text, html, etc.

--
Bone Ur
Cavemen have formidable pheromones.- Hide quoted text -

- Show quoted text -

So, you are saying i should split the navbar.html into section
(header, html,...) and call them individually at the right place?
 
J

Jonathan N. Little

Daniel said:
Hello,

Typically, I have create simple html webpages from start to finish,
everything in one html document.

I am now creating more complexe pages, and wish to compartmentalize
certain aspects. For example, the nav bar get generated by a separate
program which generate and html file, css, js.... I then call it
within my main doc. However, by doing so I end up with duplication of
head section, body.... and I assume this is not proper. The other
alternative is to copy and paste the various element of the nav bar
(styles, scripts, html) and the paste them in their respective zones.
this however, is very conterproductive as when a change need to be
made I must manually update each webpage (long and prone to errors).

What is the proper approach to doing this type of referencing multiple
docs into one.

Thank you for your experience and guidance,

Google is your friend:


http://www.google.com/search?hl=en&...html+document+into+another&btnG=Google+Search
how to include one html document into another - Google Search
 
D

Daniel

Google is your friend:

http://www.google.com/search?hl=en&q=how+to+include+one+html+document...
how to include one html document into another - Google Search

I understand the basics of including the file. My issue is that the
file in question is a html file on it's own (styles, header info,
script and html) if I include it at the appropriate place in the main
page I double up on these sections. So I end up with a 2nd header
within the body of my main page, etc.

If it were merely html coding (tables, text....) then no problem a
simple include work great but in this case i was wondering if I was
missing an obvious tip/trick that professional use.

Thank you for your reply! I am going through google in more detail.
 
J

Jonathan N. Little

I understand the basics of including the file. My issue is that the
file in question is a html file on it's own (styles, header info,
script and html) if I include it at the appropriate place in the main
page I double up on these sections. So I end up with a 2nd header
within the body of my main page, etc.

If it were merely html coding (tables, text....) then no problem a
simple include work great but in this case i was wondering if I was
missing an obvious tip/trick that professional use.

Thank you for your reply! I am going through google in more detail.

If you do Google and read about includes, be they SSI, PHP or other
server-side scripting, your will learn that the parts to be included,
are just that parts. Only put the markup for the part that is to be
inserted, i.e., for a navbar included there would only be a UL of links
with not HTML HEAD BODY on other elements...



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-language" content="en-us">
<title>Sample Page</title>
</head>
<body>

<?php include_once('/common/header.php'); ?>

<h1>A Sample PHP Include Page</h1>

<?php include_once('/common/navbar.php'); ?>

<p>
The rest of your page...
</p>

<?php include_once('/common/footer.php'); ?>

</body>
</html>
 
E

Els

I understand the basics of including the file. My issue is that the
file in question is a html file on it's own (styles, header info,
script and html) if I include it at the appropriate place in the main
page I double up on these sections. So I end up with a 2nd header
within the body of my main page, etc.

You're saying the 'file in question', navbar.html, is generated. Can't
you generate separate files? Or, instead of splitting it up and
pasting it their respective zones, just split it up once, into
different files. Those files you can then include through SSI or php
includes. A change then only has to be made once to this set of files
(formerly one navbar.html file).
If it were merely html coding (tables, text....) then no problem a
simple include work great but in this case i was wondering if I was
missing an obvious tip/trick that professional use.

If you give more info on the generation of this navbar.html file,
maybe someone will see a better way to get the result you're after.
 
B

Bone Ur

Well bust mah britches and call me cheeky, on Thu, 01 Nov 2007 20:59:31
GMT Daniel scribed:
So, you are saying i should split the navbar.html into section
(header, html,...) and call them individually at the right place?

Well, I haven't seen your work, but that's probably what I'd do. When I
use includes (seldom), it's usually just data - no styles. I find it
easier to locate styles all in one place and manipulate the pieces of data
and html as I wish without worrying about adjuncts.
 
D

Daniel

Well bust mah britches and call me cheeky, on Thu, 01 Nov 2007 20:59:31
GMT Daniel scribed:







Well, I haven't seen your work, but that's probably what I'd do. When I
use includes (seldom), it's usually just data - no styles. I find it
easier to locate styles all in one place and manipulate the pieces of data
and html as I wish without worrying about adjuncts.

--
Bone Ur
Cavemen have formidable pheromones.- Hide quoted text -

- Show quoted text -

Thank you all for your time and advice!

Daniel - Learning all the time
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top