Making one HTML page from more than one file

Discussion in 'HTML' started by =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 19, 2007.

  1. 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.
    =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 19, 2007
    #1
    1. Advertising

  2. 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!
    Toby A Inkster, Apr 19, 2007
    #2
    1. Advertising

  3. 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
    =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 21, 2007
    #3
  4. =?ISO-8859-15?Q?Manfred_Preu=DFig?=

    Desmond Guest

    On 21 Apr, 12:58, Manfred Preußig <> 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.
    Desmond, Apr 21, 2007
    #4
  5. Desmond schrieb:
    > On 21 Apr, 12:58, Manfred Preußig <> 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
    =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 22, 2007
    #5
  6. =?ISO-8859-15?Q?Manfred_Preu=DFig?=

    Desmond Guest

    On 22 Apr, 08:42, Manfred Preußig <> wrote:
    > Desmond schrieb:
    >
    >
    >
    > > On 21 Apr, 12:58, Manfred Preußig <> 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
    Desmond, Apr 22, 2007
    #6
  7. Gazing into my crystal ball I observed Desmond <> writing
    in news::

    > 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
    Adrienne Boswell, Apr 22, 2007
    #7
  8. On 22 Apr 2007 00:46:06 -0700, Desmond <> 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
    Steven Saunderson, Apr 22, 2007
    #8
  9. Hello,
    Adrienne Boswell schrieb:
    > Gazing into my crystal ball I observed Desmond <> writing
    > in news::
    >
    >> 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
    =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 22, 2007
    #9
  10. Steven Saunderson schrieb:
    > On 22 Apr 2007 00:46:06 -0700, Desmond <> 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
    =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 22, 2007
    #10
  11. =?ISO-8859-15?Q?Manfred_Preu=DFig?=

    J.O. Aho Guest

    Manfred Preußig wrote:
    > Adrienne Boswell schrieb:
    >>> 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.


    It's generally bad to allow php parse extensions like .html, as they usually
    wouldn't have any php code and to make a few files to work, it's better to
    rename those and setup a server side redirection if you want old links still work.


    > At the moment that's allready a question to me. I will ask the provider
    > what I can do there.


    They will tell you to rename yourfile.html to yourfile.php, it's bad to let
    parse maybe thousand of html pages to make your handful pages to work, when
    you can get things work with a simple rename.



    >> 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.


    If you have a page like

    --- example ---
    <html>
    <head><title>Title</title>
    <link rel="stylesheet" href="style.css" type="text/css">
    </head>
    </body>
    <?php include 'navbar.php' ?>
    Something
    </body>
    </html>
    --- eof ---

    Then you do not include any <html>-tag, nor head/body-tags, as the page will
    look for the user like this:

    --- example ---
    <html>
    <head><title>Title</title>
    <link rel="stylesheet" href="style.css" type="text/css">
    </head>
    </body>
    <a href="index,php">Home</a><a href="www.example.net/page2.php">Another page</a>
    Something
    </body>
    </html>
    --- eof ---

    If you add the <html>-tag, then you would get a none valid html code

    --- example of bad code ---
    <html>
    <head><title>Title</title>
    <link rel="stylesheet" href="style.css" type="text/css">
    </head>
    </body>
    <html><a href="index,php">Home</a><a href="www.example.net/page2.php">Another
    page</a></html>
    Something
    </body>
    </html>
    --- eof ---

    Some browsers may even not display this kind of broken page.


    > 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?


    You don't need to include extra CSS for the included page, it will be using
    the one you defined for the page, and I doubt you will be using different
    CSS:es for each page, so you can have the part for the navbar in the main CSS.
    In case you would have really special settings for each page, you break out
    all that is common for each page, have it in once CSS that you include in each
    page and then add just the CSS with page specific code in the header of each page.


    >> 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.


    There is a long tradition on ng to just quote what you reply to, but of course
    there are quite many microsoft influenced people who tend to include the whole
    previous post (including footers that never should be quoted) and even top
    post too.

    --

    //Aho
    J.O. Aho, Apr 22, 2007
    #11
  12. On Sun, 22 Apr 2007 13:18:30 +0200, Manfred Preußig <>
    wrote:

    > 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.


    This all sounds far too complicated and confusing for what you want.
    Toby's suggestion earlier to use SSI is good and will probably be
    available on your server.

    --
    Steven
    Steven Saunderson, Apr 22, 2007
    #12
  13. Gazing into my crystal ball I observed =?ISO-8859-15?Q?Manfred_Preu=DFig?
    = <> writing in news:f0ffta$if1$:

    >> 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?
    >


    Here's a typical example of pages for me:
    <? thispage = "page title"; //name of the page
    thisurl = "page.url"; //the actual url ?>
    <? include file = "linkrel.php" ?>
    </head>
    <body>
    <? include file = "nav_inc.php" ?>
    <? include file = "h1_inc.php" ?>
    <div id="content">
    </div>
    </body>
    </html>

    -- linkrel.php --
    Doctype declaration
    connection string
    head elements
    external stylesheet
    external javascript
    master functions if I'm working in asp

    Notice that there is a closing head element below the linkrel include.
    This is to have the ability to use document level style, in case that one
    page needs to have a special style that is not in the external file, or
    needs to override the external sheet.

    -- nav_inc.php --
    Navigation, usually includes a routine that sees if thisurl is the same
    as the script name, and if it is, it uses a class of currentpage.

    -- h1_inc.php --
    This may be a header, but the h1 element and the title element in
    linkrel.php use the thispage statement at the very top of the document.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne Boswell, Apr 22, 2007
    #13
  14. Manfred Preußig <> writes:

    > Steven Saunderson schrieb:
    >> On 22 Apr 2007 00:46:06 -0700, Desmond <> 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?


    The HTML parser is in the browser. It doesn't care what the extension of
    the file is, or even if the content it received was read from a file at
    all. All the browser cares about is the MIME type specified by the server
    in the HTTP headers; if that is text/html, it parses it as HTML.

    sherm--

    --
    Web Hosting by West Virginians, for West Virginians: http://wv-www.net
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Sherm Pendley, Apr 22, 2007
    #14
  15. Manfred Preußig wrote:
    > Toby A Inkster schrieb:
    >
    >> <!--#include "filename.html"-->

    >
    > This is to the html-file like a comment.


    What happens is that the server (assuming it is configured correctly),
    sees this "special" comment and strips it out, replacing it with the
    contents of "filename.html".

    The client browser never sees the comment -- it only sees the replacement.

    > Can I include it at every point in the source?


    Anywhere you like.

    > And what's about the result: It is like the code is in the original
    > file?


    Precisely.

    > What's about the code: Is this included file a complete html-file
    > (with html and body-tag and so on?)?


    You can include whatever you like in there. But if you include, say,
    <html> or <body> then you'll probably end up with an extra set of these
    tags in your final document, which is probably not desirable.

    > And what's about CSS? Where I have to set the outline? And the
    > positions?


    If you put this in, say, "navigation.html":

    <div id="navigation">
    ... blah blah blah ...
    </div>

    Then your file "index.html" might be like this:

    <html>
    <title>My site.</title>
    <style type="text/css">
    #navigation { color: orange; }
    </style>
    <h1>My site.</h1>
    <p>Here is some text.</p>
    <!--#include "navigation.html"-->
    </html>

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

    >
    > Here are the questions the same as above.


    Same answers too.

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

    * = I'm getting there!
    Toby A Inkster, Apr 23, 2007
    #15
  16. On 2007-04-23, Toby A Inkster wrote:
    > Manfred Preußig wrote:
    >> Toby A Inkster schrieb:
    >>
    >>> <!--#include "filename.html"-->

    >>
    >> This is to the html-file like a comment.

    >
    > What happens is that the server (assuming it is configured correctly),
    > sees this "special" comment and strips it out, replacing it with the
    > contents of "filename.html".


    Not like that, it won't. It will give you [an error occurred while
    processing this directive]. It should be:

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


    --
    Chris F.A. Johnson <http://cfaj.freeshell.org>
    ========= Do not reply to the From: address; use Reply-To: ========
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
    Chris F.A. Johnson, Apr 23, 2007
    #16
  17. Hello,

    J.O. Aho schrieb:
    ....
    >
    >>> 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.

    >
    > There is a long tradition on ng to just quote what you reply to, but of course
    > there are quite many microsoft influenced people who tend to include the whole
    > previous post (including footers that never should be quoted) and even top
    > post too.
    >

    not only microsoft influenced. I often ask companies for help with their
    programs or other products or for some help to find a product for my
    needs. Often these are special problems not to solve in one pass. These
    companies have of course computers and -I'm sure it is so- a database
    for all of the questions and answers and so on .. and most of my mails
    first get an answer 'your mail have reached us and is in future reported
    as ....' (where this is a very long special code for the mail). So I'm
    sure anybody in this companie would be able to read all I have written
    before ... but allways the addition comment is 'please add all of your
    mails before'.

    But we get out of topic. So this is the last I will say on it (for the
    moment).

    greetings

    Manfred
    =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 24, 2007
    #17
  18. Chris F.A. Johnson schrieb:
    > On 2007-04-23, Toby A Inkster wrote:
    >> Manfred Preußig wrote:
    >>> Toby A Inkster schrieb:
    >>>
    >>>> <!--#include "filename.html"-->
    >>> This is to the html-file like a comment.

    >> What happens is that the server (assuming it is configured correctly),
    >> sees this "special" comment and strips it out, replacing it with the
    >> contents of "filename.html".

    >
    > Not like that, it won't. It will give you [an error occurred while
    > processing this directive]. It should be:
    >
    > <!--#include virtual="filename.html" -->
    >
    >

    Hello,
    is there any other way to do this with the same result? These both don't
    work properly.

    To show what I'm doing: This ist the navigation file I first set up.
    Because I'm not able to include this before I past it eight times to
    other files. These others are allready on the site but if I want to
    change anything (like a file name in the links) I allways have to look
    for eight files to change. So I want to make an include of the main
    part, the buttons. So these are taken out to Navigation_include.html
    which is the second code part. So if this will work properly it have to
    present the main page layout and eight buttons at the left. But there
    aren't any buttons (on the server since I d't have this on my PC so I
    have to send it to the server to check it)

    First Navigation.html:

    <!doctype html public "-//W3C//DTD HTML 4.0 //EN">
    <html>
    <head>
    <link rel="stylesheet" href="./CSS/Navigation.css" type="text/css" />
    <title>Preußig-Ferien</title>
    <meta name="author" content="Manfred Preußig" />
    <meta name="generator" content="Ulli Meybohms HTML EDITOR" />
    <base target="intern" />
    </head>
    <body>
    <span id="Kopf">
    <img id="Bild" src="./Bilder/Kleines_Bild.jpg" alt="Kleines
    Bildchen">
    <h1>Ferienwohnung bei Preußig's</h1>
    </span>
    <span id="Mitte">
    <!--#include virtual="Navigation_include.html" -->
    <div id="Framerahmen">
    <textarea id="Schatten" readonly>
    </textarea>
    <iframe id="Frame" src="./Beschreibung_Inhalt.html" name="intern">
    <p>Hier befindet sich ein interner Frame (ein eingebetteter
    Bereich mit wechselndem Inhalt). Ihr Browser kann entweder keine solchen
    Frames verwenden oder es ist ihm durch von Ihnen gemachte Einstellungen
    verboten worden. <a href="./Beschreibung_fl.html">Hier</a> können Sie
    mit dem Lesen der verschiedenen Seiten ohne derartige Bestandteile beginnen.
    </p>
    <p>Here is a so-called internal frame (an incorporated part
    with switching contents). Your Browser seems to be not able or
    disallowed to present such parts. <a
    href="./Beschreibung_fl.html">Here</a> you can start to use a special
    set of pages without such incorporations.
    </p>
    </iframe>
    </div>
    </span>
    </body>
    </html>

    Then Navigation_include.html:
    <!--Dies ist ein include für die Navigation-->

    <div id="NavLeiste">
    <a href="./Beschreibung_Inhalt.html"><img
    src="./Bilder/Button_Beschreibung.gif" alt="Beschreibung aufrufen"
    border="0" class="Button" id="Button_Besch"></a>
    <a href="./Selbst_Inhalt.html"><img
    src="./Bilder/Button_Selbst.gif" alt="Wir über uns" border="0"
    class="Button" id="Button_Selbst"></a>
    <a href="./Region_Inhalt.html"><img
    src="./Bilder/Button_Region.gif" alt="Region darstellen" border="0"
    class="Button" id="Button_Region"></a>
    <a href="./Karte_Inhalt.html"><img
    src="./Bilder/Button_Karte.gif" alt="Karte zeigen" border="0"
    class="Button" id="Button_Karte"></a>
    <a href="./Anmeldung_Inhalt.html"><img
    src="./Bilder/Button_Anmeldung.gif" alt="Anmeldung schicken" border="0"
    class="Button" id="Button_Anm"></a>
    <a href="./Kontakt_Inhalt.html"><img
    src="./Bilder/Button_Kontakt.gif" alt="Informationen nachfragen"
    border="0" class="Button" id="Button_Kont"></a>
    <a href="./Impressum_Inhalt.html"><img
    src="./Bilder/Button_Impressum.gif" alt="Impressum" border="0"
    class="Button" id="Button_Imp"></a>
    <a href="./Hinweise_Inhalt.html"><img
    src="./Bilder/Button_Hinweise.gif" alt="Hinweise verschicken" border="0"
    class="Button" id="Button_Hinw"></a>
    </div>

    As the answerers before say this have to work. Why not?

    Thanks and greetings

    Manfred
    =?ISO-8859-15?Q?Manfred_Preu=DFig?=, Apr 24, 2007
    #18
  19. On Tue, 24 Apr 2007 17:31:15 +0200, Manfred Preußig <>
    wrote:

    > Hello,
    > is there any other way to do this with the same result? These both don't
    > work properly.


    [snip]

    > First Navigation.html:


    The file that has SSI commands (e.g. include virtual) generally needs to
    have a '.shtml' extension to tell the server to look for these commands.

    Try renaming Navigation.html to Navigation.shtml .

    --
    Steven
    Steven Saunderson, Apr 24, 2007
    #19
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sachin
    Replies:
    1
    Views:
    346
    Tjerk Wolterink
    Dec 1, 2005
  2. ThaDoctor
    Replies:
    3
    Views:
    299
    Jim Langston
    Oct 3, 2007
  3. Merciadri Luca
    Replies:
    4
    Views:
    802
  4. Steven D'Aprano
    Replies:
    0
    Views:
    79
    Steven D'Aprano
    Dec 23, 2013
  5. Replies:
    3
    Views:
    73
    Gary Herron
    Dec 23, 2013
Loading...

Share This Page