Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 decade ago

How can i obtain code/content from an external source page and place in multiple HTML pages?

Hi,

I'm coding a website that i have just designed for somebody. I have the majority of the layout (CSS driven) up and running. I'm using a main content area covering about 2/3 of the width of the page, with the remaining 1/4 being used to hold a floating div, containing "recent information" boxes.

I have the positioning on, and the settings for the four small boxes all done. I just need to add content to them. However, I am planning to have these boxes on more than one page, four to be exact.

Is there a way in which i can edit 1 page within the site itself (index.htm), and the changes that i make to the boxes will update all of the same boxes throughout the site (on the other three pages)?

I was wondering whether an external stylesheet of some type could be used, and have code within the box div to refer to that stylesheet. I tried looking into it but came up with no real help...

Note - The content which i want to be placed in each of the boxes is to be placed in a small table.

Much appreciated if you can help me!!

Thanks,

Ellis

5 Answers

Relevance
  • 1 decade ago

    What brisray said is accurate. PHP is, by far, the most supported and easiest way to do this. Most likely, you'll be able to include a separate file on each page:

    <html>

    <head>...</head>

    <body>

    <div id="sidebar">

    <?php

    include('something.php');

    ?>

    </div>

    [The rest of your HTML here]

    </body>

    </html>

    Don't forget to rename your file extensions to .php, or else it won't work.

  • 1 decade ago

    CSS is used for styling and isn't much use for adding content. What you want to do is possible but how you do it depends on what your server supports. You can use...

    ASP then use <!--#include file="file_name.ext"-->

    PHP then use <?php include("file_name.ext"); ?>

    If your server cannot support these languages then for AJAX techniques see http://www.xul.fr/en-xml-ajax.html

    If you've no server interaction at all you may have to write the included HTML as part of a single JavaScript file and simply use that.

  • 5 years ago

    "Tublet: greater desirable than a mouthful is a waste in case you're a mouse." "Tublet: the speedier picker-top." "Tublet: Love her or hate her, you be responsive to you are able to no longer have her, so drink that yee beer, fluff up your breasteses, and run like helll..." <---- have been given nuthin' (unhappy) :((

  • 1 decade ago

    PHP include is the answer... search php include in google.

    make sure you rename your .html to .php

  • How do you think about the answers? You can sign in to vote the answer.
  • Andy T
    Lv 7
    1 decade ago

    I am quite experienced in doing this, one word: AJAX.

Still have questions? Get your answers by asking now.