Newbie Question: How can I link to some HTML in another page?

M

michaaal

For example let's say I have a file called "file1.htm" that contains the
following data...

<table>
<tr><td>hello</td></tr>
</table>

....Now let's say I want to make a file and link it so the "file1.htm" file
like this...

<html>
<body>
<h2>hello</h2>
<<<<link this section to the FILE1.HTM file>>>>
</body>
</html>

....How would I do that? Would it be something like this?...

<html>
<body>
<h2>hello</h2>
<http://www.mydomain.com/file1.htm>
</body>
</html>
 
N

Nik Coughin

michaaal said:
For example let's say I have a file called "file1.htm" that contains
the following data...

<table>
<tr><td>hello</td></tr>
</table>

...Now let's say I want to make a file and link it so the "file1.htm"
file like this...

<html>
<body>
<h2>hello</h2>
<<<<link this section to the FILE1.HTM file>>>>
</body>
</html>

...How would I do that? Would it be something like this?...

<html>
<body>
<h2>hello</h2>
<http://www.mydomain.com/file1.htm>
</body>
</html>

<html>
<body>
<h2>hello</h2>
<a href="http://www.mydomain.com/file1.htm">My File 1</a>
</body>
</html>

Or did you mean that you want to include the contents of file1.htm at that
point in the second file?
 
N

Nik Coughin

Nik said:
<html>
<body>
<h2>hello</h2>
<a href="http://www.mydomain.com/file1.htm">My File 1</a>
</body>
</html>

Or did you mean that you want to include the contents of file1.htm at
that point in the second file?

That looks screwy in Outlook Express. When I look at the message source
there's nothing wrong with it. It should look like (without the extra
spaces):

< a h r e f = " h t t p : / / w w w . m y d o m a i n . c o m / f i l e 1
.. h t m " > M y F i l e 1 < / a >
 
M

Mark Parnell

Yes, Mark, this is what I am talking about. But how can you do it with just
straight HTML and not do it.

You can't. HTML doesn't *do* anything. It is a markup language - it
simply describes the structure of the content. Eventually you will
probably want server-side scripting, and most server-side languages have
some form of includes built it. Even if you don't have access to
server-side scripting, any decent host will offer SSI (and you may be
able to use it even if they don't think you can), and even if they don't
you can always use a preprocessor.
<frameset>
<frame src="http://www.yahoo.com">
</frameset>

*<shudder>*
There is certainly no need to resort to that sort of heresy.

http://html-faq.com/htmlframes/?framesareevil
http://homepage.ntlworld.com/l_vajzovic/tom/web/frames.html
http://dorward.me.uk/www/frames/
http://www.google.com/webmasters/2.html (see under "Your page uses
frames")
 
S

SpaceGirl

michaaal said:
Yes, Mark, this is what I am talking about. But how can you do it with just
straight HTML and not do it.

So far, I have found this method...

<frameset>
<frame src="http://www.yahoo.com">
</frameset>


Is this the best way to do this?


Frames are *not* the best way to go - while they work, it's a bad path to
start walking down for a n00b as they can lead to all kinds of
complications. There are times and places for frames, but not until you
understand the consiquences of using them.

The single best way to include one file inside another is to use a
server-side include. Assuming your server supports ASP (basically, if you
are using a Microsoft webserver called "Internet Information Server", or
IIS) this is achieved fairly painlessly;

<!--#include file="folder/file.htm" -->

The folder can be anywhere inside your website, and the file can be any text
file (such as .htm, .asp, .txt). The contents of the file are "added" to the
page by the server *before* the page is sent to the users browser, so they
will have no indication that included files were used to stick your page
together. An include can be placed *anywhere* inside your HTML document.

<p>some stuff <br /> another line </p>
<hr />
<!--#include file="folder/file.htm" -->
<hr />
<p>more stuff</p>
 
J

Jukka K. Korpela

Nik Coughin said:
That looks screwy in Outlook Express.

What "that"? Please quote the relevant part only, or otherwise make your
references clear. Also please use descriptive words, not emotional.
It should look like (without
the extra spaces):

< a h r e f = " h t t p : / / w w w . m y d o m a i n . c o m / f i
l e 1 . h t m " > M y F i l e 1 < / a >

<marquee>Then why do you use extra spaces?</marquee>

<font size="7" color="red" face="Verdana">
If your newsreader surrogate interprets HTML tags in Usenet messages,
fix its settings, or get a decent newsreader.</font>

<iframe title="Here I could have put some nasty code that crashes OE"
src="...">
</iframe>
 
T

Toby A Inkster

Jukka said:
<iframe title="Here I could have put some nasty code that crashes OE"
src="...">
</iframe>

Or even more fun...

begin hiding

Nobody using OE can see me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top