DR. WEBSITE: Server Side Includes for Pulling Data; Linking to Framed Pages; Anchor References Dear Dr. Website®: Is there a way to pull info (e.g., a table full of data) from another Web page into the current page every time the current page is opened or refreshed?
By David Fiedler and Scott Clark
The easiest way to do this is to use a Server Side Include (SSI). This would enable you to pull the info from one page into another page. People routinely do this for banner ads. The syntax varies from Web server to Web server, but generally it is as follows:
<!--#include virtual="yourfile.html" --> where "virtual" is a URL relative to the directory containing the current document being processed. Then you could just create a Web page with nothing but the table full of data, and use an SSI to include that page on whatever page you wish. It will appear to the user to be one continuous page.
SSIs must be enabled on your server for this to work; try it on a test page, as SSIs are often enabled by default. Some Web servers require that a file with an SSI have an extension of .shtml, though most will work if you chmod the file to be executable:
chmod 775 thisfile.html In addition, the following line should be used in the .htaccess file:
AddType text/x-server-parsed-html .shtml That says any file with the .shtml extension may have SSI commands to be parsed. If you don't want to use a separate .shtml extension, you can change that to .html, but then all .html files will be checked for SSIs, slowing down the server to an extent.
Dear Dr. Website®: You mention in your FAQ how to link to a non-framed page from within a framed page, but how about the other way around?
If you want the framed page to appear within your own framed pages, you'd just link to it as you normally would and it will appear within your framed page. If you want it to take over the framed page, then you need to target it like this:
<A HREF="newlink.html" TARGET="_top">this'll do it</A> That uses the "_top" target, which causes the browser to load the new framed page, assuming that newlink.html is a framed page, over the present page, framed or not.
<A HREF="framedpage.html#thisanchor" TARGET="uptoyou"> this will take you to the anchor point</A> If you don't wish to target the anchor to a specific frame, you may omit the TARGET parameter; if you do wish to target a specific frame, include the TARGET parameter (as above), substituting your targeted frame's name for "uptoyou." If you wish to escape the frameset altogether, use the TARGET="_top" parameter, as we did in the second question above. Webdeveloper.com's Home Page