Possible to Insert One HTML Doc Into Another?

Discussion in 'HTML' started by Pavlik Morosov, Aug 7, 2005.

  1. Is it possible to load an HTML document into the main HTML document, much
    like inserting a graphic?

    Could one have, say, a "header.htm" file that could be coded to load into
    any page on my site?

    If this is a dumb question, sorry, but it's the only work-around I can
    think of for a problem I'm trying to figure out.

    Thank you for any help!
    http://www.e-mail.ru
    ÔÅÄÅÐÀËÜÍÀß ÏÎ×ÒÎÂÀß ÑËÓÆÁÀ E-MAIL.RU
    http://www.e-mail.ru

    Òîëüêî äî 15 àâãóñòà êîìïàíèÿ "Êëþ÷ ÏëàñòÊîíñòðóêòîð" ïðåäëàãàåò ñêèäêè äî 20% íà ïëàñòèêîâûå îêíà è äâåðè! Çâîíèòå ñåé÷àñ.
    Tel/fax: (095) 784-64-84
    URL: http://www.kpk.ru
     
    Pavlik Morosov, Aug 7, 2005
    #1
    1. Advertising

  2. Pavlik Morosov

    Safalra Guest

    Pavlik Morosov wrote:
    > Is it possible to load an HTML document into the main HTML document, much
    > like inserting a graphic?
    > Could one have, say, a "header.htm" file that could be coded to load into
    > any page on my site?


    If your host supports server-side includes, they'd be the ideal
    solution. The only other thing I can think of (other than using
    iframes) is using a preprocessor before uploading pages, but then you'd
    have to update them all every time the page changes, which rather
    defeats the point.

    --
    Safalra (Stephen Morley)
    http://www.safalra.com/hypertext/
     
    Safalra, Aug 7, 2005
    #2
    1. Advertising

  3. Pavlik Morosov

    Spartanicus Guest

    Pavlik Morosov <> wrote:

    >Is it possible to load an HTML document into the main HTML document, much
    >like inserting a graphic?
    >
    >Could one have, say, a "header.htm" file that could be coded to load into
    >any page on my site?


    That suggests that instead of inserting a (complete) HTML document you
    want to insert a HTML code fragment instead. Both are possible but
    fundamentally different techniques.

    http://www.allmyfaqs.com/faq.pl?Include_one_file_in_another

    --
    Spartanicus
     
    Spartanicus, Aug 7, 2005
    #3
  4. "Pavlik Morosov" <> wrote in message
    news:...
    > Is it possible to load an HTML document into the main HTML document, much
    > like inserting a graphic?
    >
    > Could one have, say, a "header.htm" file that could be coded to load into
    > any page on my site?



    See bignosebird.com/ssi.shtml for instructions on SSI (Server Side
    Includes).

    --Tina
    --
    http://www.AxisHOST.com - Serving the web since 1997
    Very Generous Cpanel Hosting & Fully Managed Servers
    Newsgroup 20% Discount Code: newsgroup
     
    Tina - AxisHOST, Inc., Aug 7, 2005
    #4
  5. Pavlik Morosov

    Morosov Guest

    [Third try to get a response posted - sorry if duplicates
    appear later!]

    OK, thanks for the help so far!

    So, is this really as simple as it looks with SSI or PHP?

    Just one command inserted and changing the extension of the
    file to .php or .shtml?

    If so...wow...all the time I've wasted! 8-(

    I will have a site of many articles, and I want to be able
    to deep-link to them without having them orphaned from rest
    of the site. I want to have a single, somewhat complex header
    (though small in size) that will be at the head of every page
    on the site and which will be constantly maintained and updated
    independent of the archived articles. Let's call it...

    header.htm

    So, if I have a PHP capable provider, all I have to do with
    each article page is stick the code...

    <?php include("header.htm"); ?>

    Up in the top of the page someplace and save the page with a
    .php extension?

    Is that it? And if the site has SSI rather than PHP I can do
    something similar, as described in the page for .shtml files?

    I hope I'm understanding this right! Seems too easy! :cool:

    If this is correct and I have the choice between PHP and SSI,
    if there any reason to pick one over the other?

    Thanks for any additional clarifications.

    ===

    -=-
    This message was sent via two or more anonymous remailing services.
     
    Morosov, Aug 8, 2005
    #5
  6. Pavlik Morosov

    Safalra Guest

    Morosov wrote:
    > [snip]
    > So, if I have a PHP capable provider, all I have to do with
    > each article page is stick the code...
    > <?php include("header.htm"); ?>
    > Up in the top of the page someplace and save the page with a
    > .php extension?
    > Is that it? And if the site has SSI rather than PHP I can do
    > something similar, as described in the page for .shtml files?
    > I hope I'm understanding this right! Seems too easy! :cool:


    <philosophy>It's interesting that people are so sceptical that an easy
    to state problem should have an easy to implement
    solution.</philosophy>

    > If this is correct and I have the choice between PHP and SSI,
    > if there any reason to pick one over the other?


    I'd go with SSI for anything that doesn't require PHP features. I
    believe it is parsed slightly faster because of its simpler syntax (I'm
    sure someone will correct my if I'm wrong). Plus more hosts support SSI
    (with no security issues) than PHP (with some security issues).

    --
    Safalra (Stephen Morley)
    http://www.safalra.com/hypertext/
     
    Safalra, Aug 8, 2005
    #6
  7. Pavlik Morosov

    Toby Inkster Guest

    Safalra wrote:

    > I'd go with SSI for anything that doesn't require PHP features. I
    > believe it is parsed slightly faster because of its simpler syntax (I'm
    > sure someone will correct my if I'm wrong). Plus more hosts support SSI
    > (with no security issues) than PHP (with some security issues).


    I agree with you that it's faster and slightly more secure, but I don't
    agree that the OP should stick with SSI.

    PHP will give him a lot more flexibility in the future -- a lot more
    chance to experiment with new things : searches, login accounts, contact
    forms, etc.

    mod_php's slow down over SSI is only slight, and unless he's using a
    complete dinosaur of a web server, it should barely register a difference.

    For what he's talking about doing, security issues don't even come into
    it. It's only when you start doing things like this that security becomes
    an issue:

    <?php
    $page = $_GET['page'];
    $file = 'content/' . $page . '.php';
    include($file);
    ?>

    (and in this case there's an easy fix...

    <?php
    $page = $_GET['page'];
    if (preg_match('/\./',$page))
    {
    print "SECURITY ALERT!";
    exit;
    }
    $file = 'content/' . $page . '.php';
    include($file);
    ?>

    ..)

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Aug 9, 2005
    #7
  8. Pavlik Morosov

    AF Guest

    On Tue, 09 Aug 2005 07:57:26 +0100, Toby Inkster
    <> wrote:

    snip
    >
    >PHP will give him a lot more flexibility in the future -- a lot more
    >chance to experiment with new things : searches, login accounts, contact
    >forms, etc.
    >

    snip

    How very true. I have tried all kinds of ways to insert content into
    html pages, and I have found php to be the best way to do this.

    Can I ask the original poster, "Can you give us an example of what you
    wanted to do?" If you already have posted this, I must have missed
    it, but I would like to see an example of what you are trying to
    insert and why?

    Good luck!

    Oh, by the way, I put off learning php for years. Once I started
    learning it, it was very easy. Php is interesting because you can
    easily and quickly learn enough to be productive with it, yet php is
    complex enough it will take me a while to learn all of its usefulness.

    Just don't be put off by the very complex php stuff you see; you can
    quickly learn simple techniques that will help you, and then you can
    grow from there.


    Best regards,

    Al
    http://www.affordablefloridainsurance.com
    http://www.americanbestmortgages.com
    http://www.americanaffordablelifeinsurance.com
     
    AF, Aug 9, 2005
    #8
  9. Pavlik Morosov

    dorayme Guest

    > From: AF <bscinc3000@Yahoo_NoSpam.com>
    >
    > Oh, by the way, I put off learning php for years. Once I started
    > learning it, it was very easy. Php is interesting because you can
    > easily and quickly learn enough to be productive with it, yet php is
    > complex enough it will take me a while to learn all of its usefulness.
    >
    > Just don't be put off by the very complex php stuff you see; you can
    > quickly learn simple techniques that will help you, and then you can
    > grow from there.
    >
    >
    > Best regards,
    >
    > Al
    >


    You seem nice and maybe won't bite my delicate head off. Would you offer or
    remind me of your path to learning this? Online refs are best but maybe a
    book?

    dorayme
     
    dorayme, Aug 10, 2005
    #9
  10. Pavlik Morosov

    Safalra Guest

    dorayme wrote:
    > > From: AF <bscinc3000@Yahoo_NoSpam.com>
    > > Oh, by the way, I put off learning php for years. Once I started
    > > learning it, it was very easy. Php is interesting because you can
    > > easily and quickly learn enough to be productive with it, yet php is
    > > complex enough it will take me a while to learn all of its usefulness.
    > >
    > > Just don't be put off by the very complex php stuff you see; you can
    > > quickly learn simple techniques that will help you, and then you can
    > > grow from there.

    >
    > You seem nice


    I'm nice too. :)

    > and maybe won't bite my delicate head off. Would you offer or
    > remind me of your path to learning this? Online refs are best but maybe a
    > book?


    The online PHP documentation is very good (once you go into one of the
    sections the navigation appears in the left in a nice format, rather
    than the huge list you get on the first page):

    http://www.php.net/manual/en/

    --
    Safalra (Stephen Morley)
    http://www.safalra.com/hypertext/
     
    Safalra, Aug 10, 2005
    #10
  11. Pavlik Morosov

    AF Guest

    On Wed, 10 Aug 2005 10:21:20 +1000, dorayme <>
    wrote:

    snip
    >
    >You seem nice and maybe won't bite my delicate head off. Would you offer or
    >remind me of your path to learning this? Online refs are best but maybe a
    >book?
    >
    >dorayme
    >

    Trial and error wa show I did it.

    Here is a general rule I have figured out about php:

    If you find yourself doing the same thing, time after time, inside of
    a web page, or on many pages, there is probably a way to eliminate
    this with php.

    So I started learning php as a means to publish more pages with less
    effort.

    So I would take a simple task that I was doing many times within a
    page or doing many times on many pages, and I would find a way to do
    it better with php.

    The first problem that I attacked with this was keyword lists,
    descriptions, and titles. The way to make me more productive and
    spend less time typing keywords, descriptions, and titles was to
    figure out a way to get php to fill in variables for me.

    This involved setting up variables and populating variables and the
    echo command. I played around with this for several weeks until I was
    able to use variables and the echo command to help eliminate as much
    typing as possible. Just a small improvement, but it saved me time.

    Then I wondered could I save time in other ways. The biggest
    revelation came when I realized many of my web pages could be broken
    into several parts:

    cosmetics without regard to content
    navigation links
    content
    headers and footers, if I want these to change based on the page
    content.

    So I posted to the php newsgroup, alt.comp.lang.php, (which by the way
    is a great source of information, just like this one), and people
    pointed me to the include command in php.

    With the include and the echo commands and variable assignment, you
    can accomplish quite a bit.

    Finally the last thing I learned quickly was url parsing, or how to
    strip info from a url. I do it using the "/". Other people do it
    using variable assignment in the url.

    There are some excellent references to this in the php manual, and it
    is easy to learn.

    I won't go into all of this here. I found the trial and error method,
    using the php manual, online resources, and the newsgroup for php
    worked well for me. And I have only scratched the surface of php.

    Hope this helps. If you decide to start learning php, post questions
    and sample code at the newsgroup,alt.comp.lang.php, and you will
    usually get quick responses.

    By the way, it helps when using php, which is programmatic generation
    of pages, to use css. Css makes it very easy to format pages. The
    reason css and php are almost necessary companions is that with css
    you eliminate a lot of formatting commands, like setting fonts in your
    html, and thus if you are using php as I do, i.e. mainly as a means of
    publishing lots of pages with as little typing as possible, css is a
    great companion.
    Best regards,

    Al
    http://www.affordablefloridainsurance.com
    http://www.americanbestmortgages.com
    http://www.americanaffordablelifeinsurance.com
     
    AF, Aug 10, 2005
    #11
  12. Pavlik Morosov

    dorayme Guest

    > From: "Safalra" <>
    >
    >> You seem nice

    >
    > I'm nice too. :)
    >
    >> and maybe won't bite my delicate head off. Would you offer or
    >> remind me of your path to learning this? Online refs are best but maybe a
    >> book?

    >
    > The online PHP documentation is very good (once you go into one of the
    > sections the navigation appears in the left in a nice format, rather
    > than the huge list you get on the first page):
    >
    > http://www.php.net/manual/en/



    OK, you *are* nice so far. This looks good and I will persuse and start
    learning... and make nice includes and stop doing my silly find and change
    greping and uploading revised files to servers. It encourages me to hear the
    stories of how others struggle but triumph.

    Why is there suddenly so much traffic on this newsgroup? I am being good and
    not posting much? Would everyone please just limit the posts to interesting
    matters.

    dorayme
     
    dorayme, Aug 11, 2005
    #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. John Wallace
    Replies:
    0
    Views:
    484
    John Wallace
    Jul 22, 2003
  2. pei_world

    Insert one ASP.net Page into another

    pei_world, Dec 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    602
  3. Matt
    Replies:
    3
    Views:
    533
    Tor Iver Wilhelmsen
    Sep 17, 2004
  4. Replies:
    3
    Views:
    12,229
    Beauregard T. Shagnasty
    Jan 10, 2006
  5. Replies:
    0
    Views:
    142
Loading...

Share This Page