You are here: Re: integrating/calling multiple files into one « HTML « IT news, forums, messages
Re: integrating/calling multiple files into one

Posted by Jonathan N. Little on 11/01/07 21:54

Daniel wrote:
> On Nov 1, 5:00 pm, "Jonathan N. Little" <lws4...@centralva.net> wrote:
>> Daniel wrote:
>>> 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&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.
>

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>



--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация