Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tag to Insert HTML

    This seems like it ought to be easy (and it probably is!), but I can find a reference that tells me how to do it...

    I'd like to include a file reference in my HTML code that will load additional HTML code to replace the reference.

    Something like:
    <font face="Georgia">



    <tag ref="xxx.htm">
    </P>
    </font face=georgia>
    If xxx.htm contains:
    <font face="Georgia">
    This is a test.
    </font face=georgia>
    Then the first HTML above would be processed as if it were:
    <font face="Georgia">



    This is a test.
    </P>
    </font face=georgia>
    Is there a way to do this (what is "tag" and what is the proper syntax)?

    Thanks,

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Tag to Insert HTML

    Hi Tom

    It must be the lateness of my hour.... can I just clarify?

    Say I have a html file called index.htm, in its code you have a line that references xxx.htm. Are you saying that you want index.htm to "look" at the content of xxx.htm, see if it has the syntax This is a test. inside its code and if it does change the tags in index.htm to

    This is a test.</P>?
    Jerry

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Tag to Insert HTML

    HTML does not really have a flexible approach to this. Historically web authors have used the <iframe> tag to display the contents of a one HTML document in another one. Now it is possible to use the <object> tag the same way. If you want to "assemble" the two documents into one on the server, you can use server-side includes (SSI).

  4. #4
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tag to Insert HTML

    Jerry,

    Basically, yes. I'd like to leave the html content of index.htm unchanged. However, when I change xxx.htm, I'd like the appearance of index.htm to change to reflect the new content of xxx.htm.

    Thanks for you help on this.

  5. #5
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tag to Insert HTML

    Thanks, I'll look into using the <iframe> or <object> tag to see if one of these works for me.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Tag to Insert HTML

    Hi Tom

    There has been a recent thread about Inserting a page of links <post:=594,261>post 594,261</post:> and we finally came to the conclusion that iframes was the answer for the Lounger. However, last night I was just about to complete a little applcation for you using a javascript include that imported html content to your page if you were unable to get access to server side includes. I am at wotk at the moment (having a spot of afternoon tiffin <img src=/S/grin.gif border=0 alt=grin width=15 height=15>). I would like to show you my little solution (only works on IIS so will publish it on my site for demo purposes and send the files to you)

    I get back in the next few hours after I get home.
    Jerry

  7. #7
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tag to Insert HTML

    What a treat! I'll look forward to your trying your "little application." Thanks so much.

    I've tried the <IFRAME> approach and it seems to serve the purpose, but I'd like to try your alternative (the WIDTH and HEIGHT requirements of IFRAME seem to constrain me a little, but the scroll bars may come in handy if I continue to do this in other places).

    Thanks again.

  8. #8
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Tag to Insert HTML

    iframes ....yyyuuukkk hate the things, you just need to set your attributes up for it correctly:

    <center><iframe src="xxx.htm" width="600" height="200" frameborder="no" scrolling="no"></iframe></center> just adjust it to how you want it using pixels or percentage.

    Don't get too excited about the "application" but I suppose by definition it is: "Application-Generic term for any software program that carries out a useful task" <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Jerry

  9. #9
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tag to Insert HTML

    What about using SSI (server side include)? It sounds very close to what you need. You can include it anywhere and it's used to insert any HTML into where ever you put the #INCLUDE statement. It's handy for redudnant code or menus, etc. You may have to change slightly the layout you listed but it'll work (assuming your host lets you use it, mine does so it's not an problem but I've heard others may limit you). It has other features as well, not just for directly insertion of a file's contents.

    So you'd add a line such as anywhere you want and the server will go fetch this .html file and insert it exactly where this line goes. The .html file can contain as little or as much as you want.

    I can't put the syntax in this post as The Lounge deletes it but there is a #include statement that points to a file. This file is located where your other .html files are (and can be called anything, like .txt or .code or whatever). The server fetches that file, and inserts its contents directly into where ever this statement is in your .html page. If then sends the completed page to the user (the user sees the result of the file insertion).

    I found this nice tutorial on it, http://www.really-fine.com/tutorial_ssi.html (jump down to the "include file" section).

    Deb

  10. #10
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Tag to Insert HTML

    Hi Tom

    Well I have found my little gizmo wasn't really fit for purpose, sorry. On the other hand I have done a little bit of searching and found a method of being able to click a link and see contents of another page in the main page using javascript.

    Click here for a demo I palced a text file and a html file to show it can be done

    and here for the download from the creator.

    I reckon with a little imagination you could have a series of links viewing various files...an alternative but maybe useful....enjoy
    Jerry

  11. #11
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Tag to Insert HTML

    How about adding return false; to the end of your onclick event handlers so Firefox doesn't immediately reload the original page? (I didn't try in IE, perhaps IE behaves differently by default.)

  12. #12
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Tag to Insert HTML

    I think I did this right. I did



    Click Me Load latin.htm</p> it just disabled the link

    then



    Click Me Load latin.htm</p> and no change

    have I messed up the syntax or missed your point? <img src=/S/nosleep.gif border=0 alt=nosleep width=27 height=15>
    Jerry

  13. #13
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Tag to Insert HTML

    The latter form should prevent Firefox from following the href="#" immediately after executing the script, which is what causes the page to reload (thus clearing the effect of the script). Is it possible this only affects me??

  14. #14
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Tag to Insert HTML

    How about something like this?

    <code><p id="pone">Paragraph 1</p>
    <p id="ptwo">Paragraph 2</p>
    <p id="pthree">Click Me Load latin.htm</p>
    <p id="pfour">Click Me to Load fox.txt</p></code>

    (Rather than the current page body. Haven't tested, but the node reference seems to be needed for an in-place replacement.)

  15. #15
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Tag to Insert HTML

    I tweaked the guy's script a bit and posted another demo here: http://carbocoma.com/db_tut/testinclude.html.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •