Web Analytics Made Easy -
StatCounter Embedding HTML w/in HTML - CodingForum

Announcement

Collapse
No announcement yet.

Embedding HTML w/in HTML

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Embedding HTML w/in HTML

    I want to put a list of HTML-formatted links in my page that can be edited from a single external source. Since I realize this is a bit hard to describe, here's an image:



    You see the links on the left of the page? I'd like to be able to embed those, or a set of links like them, in the page from an external file. I do have CSS, and the links would be going into <div class="left">, if that makes any difference.

    Attempted clarification note: I don't mind if it's static or dynamic; it's that this section will be undergoing a lot of editing, and I'd rather not have to do it manually in all 20+ pages I'll have to edit.

    Maybe there's a better way than what I'm asking for. I'm very much self-taught in all this, over the past few weeks, and realize that there are significant gaps in what I know and understand, so any other suggestions that would accomplish the ease of editing that I'm looking for would be welcome.

    *Side question: Is it possible to put HTML into CSS for it to show automatically with certain div classes? Note: Answered

    Thank you so much for your time and help!

    -'Dee

    EDIT: I write my coding with a text editor and wouldn't have a clue how to use Dreamweaver or other software even if I had easy access to them, so please bear that in mind when offering suggestions. Thanks!
    Last edited by Carradee; Oct 10, 2006, 02:02 PM.

  • #2
    Addressing your side question: you cannot write HTML with CSS.

    With regards to the main issue: what you seem to be asking for is the ability to dynamically append content to a file. You would need to use either SSI, PHP, XSLT, or frames. The first two require that your server be configured to use those and the last is the easiest, but worst, method of doing this as it causes numerous other problems. XSLT is probably the hardest since you need to learn a new language. Resources:

    Comment


    • #3
      "seem to be asking"... Sorry for being vague.

      I don't mind if it's static or dynamic; I'd just like the ability to outsource a section of the page for easier updating. I'm assuming it's possible, as it logically follows some of the other abilities (like outsourcing a stylesheet or a script).

      Of SSI, PHP, and XSLT, which do you think would be the best to try? I.e., most compatibility, cleanest code, etc.?

      Thank you very much!

      -'Dee

      Comment


      • #4
        I think most people would recommend PHP; whether or not you can use it depends on your host supporting PHP, however.

        Comment


        • #5
          Okay. Thank you!

          Just to make sure I understand you correctly: There's no way, then, to embed an HTML-formatted section w/in an HTML page from an external file?

          -'Dee

          Comment


          • #6
            Thank you very much! [jots that down to study]

            Okay, just to make sure I'm not missing something: there's no way to embed an HTML-formatted section by an external link within a larger HTML (or XHTML) page?

            [e-hug] Thanks for your help!

            -'Dee

            Comment


            • #7
              Only with an iFrame would you be able to 'embed' HTML within HTML; the best approach would be some kind of server side includes though as said above (PHP is probably the better option).
              markaylward.co.uk

              Comment


              • #8
                Thanks, Mark!

                I guess I should've mentioned that I have a paid server where I write & upload all pages from scratch...

                But thank you, both of you, for your time and assistance!

                -'Dee

                Comment


                • #9
                  Hi Dee,

                  If you can check out wether your hosting supports, either: PHP, ASP, or SSI...and let us know...

                  ...then we could tell you exactly how to do it.

                  I was just about to type the PHP method up, but thought it may be better to hang fire, until I know what your server supports - though PHP support is usually a given for most (above the very basic) paid hosting packages.

                  But, in theory, it really is very simple.

                  Kind regards,

                  Gary
                  'cna ne1 plz giv cod'

                  Comment


                  • #10
                    My server's "manual" section is very user un-friendly—at least, it is for me. Then again, I do have virtually no idea of what I'm doing.

                    It mentions PHP with a tutorial reference, so I'm assuming PHP is usable. No mention of ASP or SSI... but that doesn't mean much, since CSS isn't mentioned, either.

                    I have no idea how normal it is for your server insides to resemble the file directory of an old Windows comp.

                    Thank you very much for your help!

                    -'Dee
                    Last edited by Carradee; Oct 11, 2006, 10:28 AM.

                    Comment


                    • #11
                      <quote>
                      Learn more about your own PHP settings by following these instructions:

                      If you don't already have an info.php page on your server, please create a new text file and upload it to your server. Name the file info.php

                      Your new info.php page should have 1 line of code only. Please put the following code in your new file:

                      <?php phpinfo() ?>

                      That's all you need, now save the file to your server, and view the php page in your browser.

                      Once you view this new page in your web browser, it will populate the page with all the PHP settings and values. It is a good resource to determine what the current settings are for your PHP installation.

                      </quote>
                      Reference <code>http://www.ultimatelocator.com/phpinfo.htm</code>

                      Andy

                      Comment


                      • #12
                        What does a 500 server error mean? (http://www.mistiwolanski.com/info.php)

                        I put the "info.php" file in the public_html folder. :-/

                        Did I do that wrongly or do I need to contact my server?

                        Any tips for how I can check if my server can have ASP or SSI? (I'm Googling now, but that's complicated by my not knowing what I'm looking for.)

                        Thanks (and I'm sorry for being so hapless)!

                        -'Dee

                        Comment


                        • #13
                          I don't get a 500 server error on that page. Based on what's displayed instead, it looks like your server supports PHP 4.4.2. That means that you should be able to utilize a PHP Include. With regards to finding out if your server supports SSI, the easiest method is to try and use it, just like you just did with PHP.

                          Also, someone mentioned that the only way to embed HTML with HTML is via iframes; that's not entirely correct as the object element can be used to embed files of any type within a page. One limitation there is Internet Explorer's poor support of that element; last time I checked it worked fine with HTML documents though. Another limitation is that objects inserted via that or the iframe element are external to the page in the end result and thus the contents can't be altered via CSS or JavaScript. PHP and SSI make the inserted code an actual part of the end document, bypassing that issue.

                          Comment

                          Working...
                          X