Include html text in a webpage

Discussion in 'HTML' started by Gregor Traven, Oct 20, 2004.

  1. Hi,

    I want to include a certain html page or just a piece of html text that is
    written in any other file in my html page. How can i do it?

    All my html pages have a common header or menu so I want to know how to
    include a html text that defines this header or menu in all my html
    documents. When I want to update header or menu, i just need to update one
    file only.

    Thanks for answering

    Gregor
     
    Gregor Traven, Oct 20, 2004
    #1
    1. Advertising

  2. On Wed, 20 Oct 2004 18:12:40 +0200, Gregor Traven wrote:

    > Hi,
    >
    > I want to include a certain html page or just a piece of html text that is
    > written in any other file in my html page. How can i do it?
    >
    > All my html pages have a common header or menu so I want to know how to
    > include a html text that defines this header or menu in all my html
    > documents. When I want to update header or menu, i just need to update one
    > file only.
    >
    > Thanks for answering
    >
    > Gregor


    SSI:
    <!--#include filename.html -->

    PHP:
    <?include("filename.html");?>

    ASP:
    Uses SSI Syntax

    JSP:
    Not sure of syntax. It is probably possible, though.

    ColdFusion:
    Not sure. Can probably use SSI syntax, though.

    etc....

    --
    Jeffrey D. Silverman |
    Website | http://www.newtnotes.com

    Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Oct 20, 2004
    #2
    1. Advertising

  3. Gregor Traven wrote:
    > All my html pages have a common header or menu so I want to know how to
    > include a html text that defines this header or menu in all my html
    > documents. When I want to update header or menu, i just need to update one
    > file only.


    http://allmyfaqs.com/faq.pl?Include_one_file_in_another
     
    Leif K-Brooks, Oct 20, 2004
    #3
  4. Gregor Traven

    Noël® Guest


    > ColdFusion:
    > Not sure. Can probably use SSI syntax, though.


    <cfinclude template="filename.html">

    Noel
     
    Noël®, Oct 20, 2004
    #4
  5. .oO(Jeffrey Silverman)

    >PHP:
    ><?include("filename.html");?>


    Short open tags are unreliable, so it should be

    <?php ... ?>

    And JFTR: 'include' doesn't require parentheses, it's no function.

    Micha
     
    Michael Fesser, Oct 20, 2004
    #5
  6. Gregor Traven

    brucie Guest

    In alt.html Michael Fesser said:

    > Short open tags are unreliable, so it should be
    > <?php ... ?>


    URL?


    --


    v o i c e s
     
    brucie, Oct 20, 2004
    #6
  7. brucie wrote:
    > In alt.html Michael Fesser said:


    >> Short open tags are unreliable, so it should be
    >> <?php ... ?>


    > URL?


    More precisely, short tags are turned off on some installs of PHP, not least
    because they need working around when an XML prolog is used. Its a
    configuration option.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Oct 20, 2004
    #7
  8. Gregor Traven

    brucie Guest

    In alt.html David Dorward said:

    >>> Short open tags are unreliable, so it should be
    >>> <?php ... ?>


    >> URL?


    > More precisely, short tags are turned off on some installs of PHP, not least
    > because they need working around when an XML prolog is used.


    i thought he was referring to some prase error bug thingy.

    > Its a configuration option.


    which doesn't make them unreliable.


    --


    v o i c e s
     
    brucie, Oct 20, 2004
    #8
  9. brucie wrote:

    >> Its a configuration option.


    > which doesn't make them unreliable.


    It does in the sense that if you distribute the script you can't know if it
    will work in the target environment. :)

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Oct 20, 2004
    #9
  10. .oO(brucie)

    >In alt.html Michael Fesser said:
    >
    >> Short open tags are unreliable, so it should be
    >> <?php ... ?>

    >
    >URL?


    <http://www.php.net/manual/en/language.basic-syntax.php#language.basic-syntax.phpmode>

    "The first way, <?php. . .?>, is the preferred method, as it allows the
    use of PHP in XML-conformant code such as XHTML.

    The second way is not available always. Short tags are available only
    when they have been enabled. This can be done via the short_tags()
    function (PHP 3 only), by enabling the short_open_tag configuration
    setting in the PHP config file, or by compiling PHP with the
    --enable-short-tags option to configure. Even if it is enabled by
    default in php.ini-dist, use of short tags are discouraged."

    Micha
     
    Michael Fesser, Oct 20, 2004
    #10
  11. Gregor Traven

    brucie Guest

    In alt.html Michael Fesser said:

    > short tags are available only when they have been enabled.


    no shit.



    --


    v o i c e s
     
    brucie, Oct 20, 2004
    #11
  12. On Wed, 20 Oct 2004 22:51:54 +0100, David Dorward wrote:

    > brucie wrote:
    >
    >>> Its a configuration option.

    >
    >> which doesn't make them unreliable.

    >
    > It does in the sense that if you distribute the script you can't know if it
    > will work in the target environment. :)


    How about "less portable," then, instead of "unreliable"?

    --
    Jeffrey Silverman

    ** Drop "PANTS" to reply by email
     
    Jeffrey Silverman, Oct 21, 2004
    #12
    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. Hervé
    Replies:
    4
    Views:
    12,933
    Hervé
    Sep 30, 2003
  2. Replies:
    1
    Views:
    481
  3. Andreas Bogenberger
    Replies:
    3
    Views:
    1,009
    Andreas Bogenberger
    Feb 22, 2008
  4. Malcolm Greene
    Replies:
    1
    Views:
    461
    Martin v. Loewis
    Apr 16, 2010
  5. Replies:
    0
    Views:
    606
Loading...

Share This Page