Forum Moderators: not2easy

Message Too Old, No Replies

Referencing files

This title is probably misleading

         

Todmeister

12:40 pm on Mar 26, 2009 (gmt 0)

10+ Year Member



Okay, so, this is related to the other issue I posted about here.

When you call to an external stylesheet, you (or at least, I) use the command:

<link rel="stylesheet" href=".../stylesheet.css" type="text/css">

which tells the web page to open stylesheet.css and read the contents. Of course, this is placed in the html above the body of the document.

However, is it possible to use a similar command to instruct a web page to open a file, and import its contents into the body of that page? For instance, the page I have in mind would read:

<html>
<head>
<title>Title</title>

<link rel="stylesheet" href=".../stylesheet.css" type="text/css">

<style type="text/css">
</style>
</head>

<BODY>

<MAGICAL LINKING CODE TO layout.html>

<div class="rightframe">
TEXT IN HERE
</div>

</body>
</html>

where layout.html reads:

<div class="mainimage">
<img src="../images/ccpheader.jpg" width="1005">
</div>

<div class="leftframe">
<iframe src="../links.html" frameborder="0" name="leftframe" width="170"
height="700"></iframe>
</div>

where <MAGICAL LINKING CODE TO layout.html> would be put on every page, similar to a stylesheet (in which the three divs would be created, etc.). It's essentially just trying to save copying and pasting the contents of layout.html into every page, which would be annoying if, for instance, the width of mainimage had to be changed.

Any thoughts? Hope this is clear.

mattur

12:50 pm on Mar 26, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There isn't a standard way to do this in the HTML i.e. client side as you can with CSS.

You can either setup your authoring tool to treat this standard code as a lump, or use Server Side Includes (SSI) to compile pages on the server. See How to Generate Footer Text Message for all pages? [webmasterworld.com] for a good discussion.

Todmeister

3:37 pm on Mar 26, 2009 (gmt 0)

10+ Year Member



Thanks! I've now adapted my code to include the extras with iframe commands, as it seemed easier than learning php or SSI, and works fine... until I tell you that I'm having trouble getting the new pages to open properly. They're currently restricted to the links div class XD.

Back to the drawing board...