Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Making one HTML page from more than one file

Reply
Thread Tools

Making one HTML page from more than one file

 
 
=?ISO-8859-15?Q?Manfred_Preu=DFig?=
Guest
Posts: n/a
 
      04-19-2007
Hello,
I use as start of my site one page with an image map on it. The content
pages are with a navigation bar at their side. So I need one and the
same navigation bar in more than one file. It is a little bit
impractical to use the nav-bar in each of these files one time since if
changes are needed it have to be changed in each file for it's own. So I
thought of a possibility to make a different file only containing the
nav-bar and some others containing the rest. Than I thought inside of
the different files is a kind of include to tie these files together. In
'C' this would be easy to do (just '#include <filename>' at the point it
is needed (it is recommended but not need to be at the file start)) but
can I do it in HTML and if how?

Thanks and greetings

Manfred

P.s.: If allready answered anywhere else please excuse me. I had no idea
which words I could use for searching. I have tried with some but there
were even no answers or thousands.
 
Reply With Quote
 
 
 
 
Toby A Inkster
Guest
Posts: n/a
 
      04-19-2007
Manfred Preußig wrote:

> In 'C' this would be easy to do (just '#include <filename>' at the point
> it is needed (it is recommended but not need to be at the file start))
> but can I do it in HTML and if how?


In pure HTML no, but there exist several different mechanisms for doing
what you describe with server-side scripting languages. The simplest of
these is languages is called "Server-Side Includes (SSI)" -- indeed, it is
so basic that it can barely be called a scripting language. To include a
file, you just use:

<!--#include "filename.html"-->

Easy. However, you'll need to make sure that your server supports this
feature. You don't need to worry about browser support for any particular
server-side technology though -- just server support. As you appear to
come from a C background, think of the server-side technology as being an
odd compiler extension -- if you write code that uses the odd compiler
extension, you only have to worry that your compiler supports the
extension -- you don't need to worry if the people running the
already-compiled program have a compiler that supports the extension.

Better yet would be to learn PHP, which really is a full-blown programming
language that can be embedded in web pages. Its syntax is much like C, but
it's more abstract, so you don't need to worry about memory management and
pointers and so on. Here's an example:

<p class="sum">Here is a tricky sum:<br>
<?php
$i = 123;
$j = 456;
printf('%d + %d = %d', $i, $j, $i+$j);
?>
</p>

And here's how you include a file with PHP:

<?php
include "filename.html";
?>

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
 
Reply With Quote
 
 
 
 
=?ISO-8859-15?Q?Manfred_Preu=DFig?=
Guest
Posts: n/a
 
      04-21-2007
Hello, and thanks. I have some additional questions to it:
Toby A Inkster schrieb:
> Manfred Preußig wrote:
>
>> In 'C' this would be easy to do (just '#include <filename>' at the point
>> it is needed (it is recommended but not need to be at the file start))
>> but can I do it in HTML and if how?

>
> In pure HTML no, but there exist several different mechanisms for doing
> what you describe with server-side scripting languages. The simplest of
> these is languages is called "Server-Side Includes (SSI)" -- indeed, it is
> so basic that it can barely be called a scripting language. To include a
> file, you just use:
>
> <!--#include "filename.html"-->

This is to the html-file like a comment. Can I include it at every point
in the source? And what's about the result: It is like the code is in
the original file? What's about the code: Is this included file a
complete html-file (with html and body-tag and so on?)? And what's about
CSS? Where I have to set the outline? And the positions?
>
> Easy. However, you'll need to make sure that your server supports this
> feature. You don't need to worry about browser support for any particular
> server-side technology though -- just server support. As you appear to
> come from a C background, think of the server-side technology as being an
> odd compiler extension -- if you write code that uses the odd compiler
> extension, you only have to worry that your compiler supports the
> extension -- you don't need to worry if the people running the
> already-compiled program have a compiler that supports the extension.
>
> Better yet would be to learn PHP, which really is a full-blown programming
> language that can be embedded in web pages. Its syntax is much like C, but
> it's more abstract, so you don't need to worry about memory management and
> pointers and so on. Here's an example:
>
> <p class="sum">Here is a tricky sum:<br>
> <?php
> $i = 123;
> $j = 456;
> printf('%d + %d = %d', $i, $j, $i+$j);
> ?>
> </p>
>
> And here's how you include a file with PHP:
>
> <?php
> include "filename.html";
> ?>
>

Here are the questions the same as above.

The code I want to embed is the navigation bar of the page so the
contents have to make changes to the presentation. But the only change
is the change of the file in an iframe so possibly this can be shifted
to the embedded file to make it work.

So again many thanks for this allready here. I ask my provider for
features his site have. Wait and see what I can use there.

greetings

ManfredP
 
Reply With Quote
 
Desmond
Guest
Posts: n/a
 
      04-21-2007
On 21 Apr, 12:58, Manfred Preußig <(E-Mail Removed)> wrote:
> Hello, and thanks. I have some additional questions to it:
> Toby A Inkster schrieb:> Manfred Preußig wrote:
>
> >> In 'C' this would be easy to do (just '#include <filename>' at the point
> >> it is needed (it is recommended but not need to be at the file start))
> >> but can I do it in HTML and if how?

>
> > In pure HTML no, but there exist several different mechanisms for doing
> > what you describe with server-side scripting languages. The simplest of
> > these is languages is called "Server-Side Includes (SSI)" -- indeed, it is
> > so basic that it can barely be called a scripting language. To include a
> > file, you just use:

>
> > <!--#include "filename.html"-->

>
> This is to the html-file like a comment. Can I include it at every point
> in the source? And what's about the result: It is like the code is in
> the original file? What's about the code: Is this included file a
> complete html-file (with html and body-tag and so on?)? And what's about
> CSS? Where I have to set the outline? And the positions?
>
>
>
>
>
> > Easy. However, you'll need to make sure that your server supports this
> > feature. You don't need to worry about browser support for any particular
> > server-side technology though -- just server support. As you appear to
> > come from a C background, think of the server-side technology as being an
> > odd compiler extension -- if you write code that uses the odd compiler
> > extension, you only have to worry that your compiler supports the
> > extension -- you don't need to worry if the people running the
> > already-compiled program have a compiler that supports the extension.

>
> > Better yet would be to learn PHP, which really is a full-blown programming
> > language that can be embedded in web pages. Its syntax is much like C, but
> > it's more abstract, so you don't need to worry about memory management and
> > pointers and so on. Here's an example:

>
> > <p class="sum">Here is a tricky sum:<br>
> > <?php
> > $i = 123;
> > $j = 456;
> > printf('%d + %d = %d', $i, $j, $i+$j);
> > ?>
> > </p>

>
> > And here's how you include a file with PHP:

>
> > <?php
> > include "filename.html";
> > ?>

>
> Here are the questions the same as above.
>
> The code I want to embed is the navigation bar of the page so the
> contents have to make changes to the presentation. But the only change
> is the change of the file in an iframe so possibly this can be shifted
> to the embedded file to make it work.
>
> So again many thanks for this allready here. I ask my provider for
> features his site have. Wait and see what I can use there.
>
> greetings
>
> ManfredP- Hide quoted text -
>
> - Show quoted text -


Don't forget if your using
<?php
include "filename.html";
?>
You will need to change the main page to .php as well. And watch out.
php is case sensitive.

Desmond.


 
Reply With Quote
 
=?ISO-8859-15?Q?Manfred_Preu=DFig?=
Guest
Posts: n/a
 
      04-22-2007
Desmond schrieb:
> On 21 Apr, 12:58, Manfred Preußig <(E-Mail Removed)> wrote:
>> Hello, and thanks. I have some additional questions to it:
>> Toby A Inkster schrieb:> Manfred Preußig wrote:
>>
>>>> In 'C' this would be easy to do (just '#include <filename>' at the point
>>>> it is needed (it is recommended but not need to be at the file start))
>>>> but can I do it in HTML and if how?
>>> In pure HTML no, but there exist several different mechanisms for doing
>>> what you describe with server-side scripting languages. The simplest of
>>> these is languages is called "Server-Side Includes (SSI)" -- indeed, it is
>>> so basic that it can barely be called a scripting language. To include a
>>> file, you just use:
>>> <!--#include "filename.html"-->

>> This is to the html-file like a comment. Can I include it at every point
>> in the source? And what's about the result: It is like the code is in
>> the original file? What's about the code: Is this included file a
>> complete html-file (with html and body-tag and so on?)? And what's about
>> CSS? Where I have to set the outline? And the positions?
>>
>>
>>
>>
>>
>>> Easy. However, you'll need to make sure that your server supports this
>>> feature. You don't need to worry about browser support for any particular
>>> server-side technology though -- just server support. As you appear to
>>> come from a C background, think of the server-side technology as being an
>>> odd compiler extension -- if you write code that uses the odd compiler
>>> extension, you only have to worry that your compiler supports the
>>> extension -- you don't need to worry if the people running the
>>> already-compiled program have a compiler that supports the extension.
>>> Better yet would be to learn PHP, which really is a full-blown programming
>>> language that can be embedded in web pages. Its syntax is much like C, but
>>> it's more abstract, so you don't need to worry about memory management and
>>> pointers and so on. Here's an example:
>>> <p class="sum">Here is a tricky sum:<br>
>>> <?php
>>> $i = 123;
>>> $j = 456;
>>> printf('%d + %d = %d', $i, $j, $i+$j);
>>> ?>
>>> </p>
>>> And here's how you include a file with PHP:
>>> <?php
>>> include "filename.html";
>>> ?>

>> Here are the questions the same as above.
>>
>> The code I want to embed is the navigation bar of the page so the
>> contents have to make changes to the presentation. But the only change
>> is the change of the file in an iframe so possibly this can be shifted
>> to the embedded file to make it work.
>>
>> So again many thanks for this allready here. I ask my provider for
>> features his site have. Wait and see what I can use there.
>>
>> greetings
>>
>> ManfredP- Hide quoted text -
>>
>> - Show quoted text -

>
> Don't forget if your using
> <?php
> include "filename.html";
> ?>
> You will need to change the main page to .php as well. And watch out.
> php is case sensitive.
>
> Desmond.
>
>

What do you mean? All of the pages have to be php? The code segment
looked to me a little bit like embedded CSS statements so I don't really
understand what you mean by this. The first page (saved as index.html)
is an image map with an image of the house. All of it is to present a
vacancy site to the people and the image is of the house the site is in.
There I don't need php and I don't know where to use. Is a dummy
statement enough?

Thanks and greetings

Manfred
 
Reply With Quote
 
Desmond
Guest
Posts: n/a
 
      04-22-2007
On 22 Apr, 08:42, Manfred Preußig <(E-Mail Removed)> wrote:
> Desmond schrieb:
>
>
>
> > On 21 Apr, 12:58, Manfred Preußig <(E-Mail Removed)> wrote:
> >> Hello, and thanks. I have some additional questions to it:
> >> Toby A Inkster schrieb:> Manfred Preußig wrote:

>
> >>>> In 'C' this would be easy to do (just '#include <filename>' at the point
> >>>> it is needed (it is recommended but not need to be at the file start))
> >>>> but can I do it in HTML and if how?
> >>> In pure HTML no, but there exist several different mechanisms for doing
> >>> what you describe with server-side scripting languages. The simplest of
> >>> these is languages is called "Server-Side Includes (SSI)" -- indeed, it is
> >>> so basic that it can barely be called a scripting language. To include a
> >>> file, you just use:
> >>> <!--#include "filename.html"-->
> >> This is to the html-file like a comment. Can I include it at every point
> >> in the source? And what's about the result: It is like the code is in
> >> the original file? What's about the code: Is this included file a
> >> complete html-file (with html and body-tag and so on?)? And what's about
> >> CSS? Where I have to set the outline? And the positions?

>
> >>> Easy. However, you'll need to make sure that your server supports this
> >>> feature. You don't need to worry about browser support for any particular
> >>> server-side technology though -- just server support. As you appear to
> >>> come from a C background, think of the server-side technology as being an
> >>> odd compiler extension -- if you write code that uses the odd compiler
> >>> extension, you only have to worry that your compiler supports the
> >>> extension -- you don't need to worry if the people running the
> >>> already-compiled program have a compiler that supports the extension.
> >>> Better yet would be to learn PHP, which really is a full-blown programming
> >>> language that can be embedded in web pages. Its syntax is much like C, but
> >>> it's more abstract, so you don't need to worry about memory management and
> >>> pointers and so on. Here's an example:
> >>> <p class="sum">Here is a tricky sum:<br>
> >>> <?php
> >>> $i = 123;
> >>> $j = 456;
> >>> printf('%d + %d = %d', $i, $j, $i+$j);
> >>> ?>
> >>> </p>
> >>> And here's how you include a file with PHP:
> >>> <?php
> >>> include "filename.html";
> >>> ?>
> >> Here are the questions the same as above.

>
> >> The code I want to embed is the navigation bar of the page so the
> >> contents have to make changes to the presentation. But the only change
> >> is the change of the file in an iframe so possibly this can be shifted
> >> to the embedded file to make it work.

>
> >> So again many thanks for this allready here. I ask my provider for
> >> features his site have. Wait and see what I can use there.

>
> >> greetings

>
> >> ManfredP- Hide quoted text -

>
> >> - Show quoted text -

>
> > Don't forget if your using
> > <?php
> > include "filename.html";
> > ?>
> > You will need to change the main page to .php as well. And watch out.
> > php is case sensitive.

>
> > Desmond.

>
> What do you mean? All of the pages have to be php? The code segment
> looked to me a little bit like embedded CSS statements so I don't really
> understand what you mean by this. The first page (saved as index.html)
> is an image map with an image of the house. All of it is to present a
> vacancy site to the people and the image is of the house the site is in.
> There I don't need php and I don't know where to use. Is a dummy
> statement enough?
>
> Thanks and greetings
>
> Manfred- Hide quoted text -
>
> - Show quoted text -


What I ment is you cant use the statment

<?php
include "filename.html";
?>
on a file with an extension of .html it will not work the file has to
be changed to .php.
php is not used in PURE html

 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      04-22-2007
Gazing into my crystal ball I observed Desmond <(E-Mail Removed)> writing
in news:(E-Mail Removed) oups.com:

> What I ment is you cant use the statment
>
> <?php
> include "filename.html";
> ?>
> on a file with an extension of .html it will not work the file has to
> be changed to .php.
> php is not used in PURE html
>
>


No, you can use anything in there, as long as the server can parse it.
The extension does not have to be php either, as long as the server has
been configured to parse html as php.

However, I will say that one should not try to include an entire HTML
page within another, because one would get duplicate head elements. As
when replying to usenet posts, only include the relevant information.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
Steven Saunderson
Guest
Posts: n/a
 
      04-22-2007
On 22 Apr 2007 00:46:06 -0700, Desmond <(E-Mail Removed)> wrote:

> What I ment is you cant use the statment
>
> <?php
> include "filename.html";
> ?>
> on a file with an extension of .html it will not work the file has to
> be changed to .php.
> php is not used in PURE html


I don't think the extension of the filename of the included file
matters. I have PHP scripts that 'include' files such as index.inc and
these files contain PHP statements that are parsed correctly.

--
Steven
 
Reply With Quote
 
=?ISO-8859-15?Q?Manfred_Preu=DFig?=
Guest
Posts: n/a
 
      04-22-2007
Hello,
Adrienne Boswell schrieb:
> Gazing into my crystal ball I observed Desmond <(E-Mail Removed)> writing
> in news:(E-Mail Removed) oups.com:
>
>> What I ment is you cant use the statment
>>
>> <?php
>> include "filename.html";
>> ?>
>> on a file with an extension of .html it will not work the file has to
>> be changed to .php.
>> php is not used in PURE html
>>
>>

>
> No, you can use anything in there, as long as the server can parse it.

At the moment that's allready a question to me. I will ask the provider
what I can do there.
> The extension does not have to be php either, as long as the server has
> been configured to parse html as php.

That's about to be checked too.
>
> However, I will say that one should not try to include an entire HTML
> page within another, because one would get duplicate head elements.

Of course. If I do it like this I will make it through a special page
only for this. But even there it was the question if tags like <HTML>
have to be in there too. The duplicate header I think I need at one
point: To incorporate the CSS. Or is the setting in the including file
valid for the included file too?

> As
> when replying to usenet posts, only include the relevant information.
>

Sorry, I'm new user to usenet (in germany free servers for it are going
less and web forums are going more) and in forums the handling is
indifferent -some wants big quotes some not. Whatever you do -anybody
put critics on it. So ... I know it for the future.

Thanks to all for the information ... I will try it all.


Manfred
 
Reply With Quote
 
=?ISO-8859-15?Q?Manfred_Preu=DFig?=
Guest
Posts: n/a
 
      04-22-2007
Steven Saunderson schrieb:
> On 22 Apr 2007 00:46:06 -0700, Desmond <(E-Mail Removed)> wrote:
>

....
> I don't think the extension of the filename of the included file
> matters. I have PHP scripts that 'include' files such as index.inc and
> these files contain PHP statements that are parsed correctly.
>

Taht are good news. But ... that it works with these other extensions
don't really mean that it works with php in *.html ... sadly since the
php-parser may take all extensions ... but what's about the html-parser?
So that's another question for the provider.

Thanks

Manfred
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Like all great travelers, I have seen more than I remember andremember more than I have seen. shenrilaa@gmail.com Java 0 03-06-2008 08:11 AM
Like all great travelers, I have seen more than I remember andremember more than I have seen. shenrilaa@gmail.com C++ 0 03-05-2008 08:41 AM
Like all great travelers, I have seen more than I remember andremember more than I have seen. shenrilaa@gmail.com C Programming 0 03-05-2008 03:26 AM
making more than one test in a 'for' statement ? ThaDoctor C++ 3 10-03-2007 09:34 PM
can we access more than one xml file from one single xls file. sachin XML 1 12-01-2005 09:56 AM



Advertisments