Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > "common" HTML import file

Reply
Thread Tools

"common" HTML import file

 
 
Hortich
Guest
Posts: n/a
 
      05-22-2005
Hi, I am new to HTML but not to programming. I have a simple HTML question.
I am going to be verbose as I want you to understand my problem (rather than
just asking how to do something).

I have pasted the contents of my file "one.htm" below. I also have files
"two.htm", "three.htm", and "four.htm". In all these files, the section

<head>
<style type="text/css">
@import "myCSS.css";
</style>

<div class="s1">
<p><a href="one.htm">One</a></p>
<p><a href="two.htm">Two</a></p>
<p><a href="three.htm">Three</a></p>
<p><a href="four.htm">Four</a></p>
</div>
</head>

is identical. The rest of the file content is very different. I would like
to "import" somehow this same text from a file into each of my HTML pages.
The reason I want to do this is because in my real HTML pages, I have 36
pages and I don't want to change each one of them each time I want to add a
new page (eg "<p><a href="five.htm">Five</a></p>" in the above example). I
think I want to take the code above and put it in a file called
"common.htm", then in each of my 36 other HTML pages I want to say something
like @import "common.htm". I then change my file "common.htm" once and all
the changes are replicated in all 36 other pages. I am not sure how to do
this, or if it can be done, but I am sure I do not want to go down the
"frames" route.

I would really appreciate some guidance here, or just the basic vocab to use
so I can google out the information.

Thank you

Hortich


Here is the content on "one.htm".



<html>

<head>
<style type="text/css">
@import "myCSS.css";
</style>

<div class="s1">
<p><a href="one.htm">One</a></p>
<p><a href="two.htm">Two</a></p>
<p><a href="three.htm">Three</a></p>
<p><a href="four.htm">Four</a></p>
</div>
</head>

<body>
<div class="s2">
this is the body in the html page for one.htm.
this is the body in the html page for one.htm.
this is the body in the html page for one.htm.
this is the body in the html page for one.htm.
this is the body in the html page for one.htm.
this is the body in the html page for one.htm.
this is the body in the html page for one.htm.
this is the body in the html page for one.htm.
</div>
<body>

</html>


 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      05-22-2005
Hortich wrote:

> I have pasted the contents of my file "one.htm" below. I also have files
> "two.htm", "three.htm", and "four.htm". In all these files, the section
>


<snip>

You should pay a visit to http://validator.w3.org/. All HTML documents must
have a <title> element in the <head>, and content (such as <div> elements)
may go only in the <body>.

> is identical. The rest of the file content is very different. I would like
> to "import" somehow this same text from a file into each of my HTML pages.


http://www.allmyfaqs.com/faq.pl?Incl...ile_in_another

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
 
 
 
Spartanicus
Guest
Posts: n/a
 
      05-22-2005
"Hortich" <> wrote:

>I am new to HTML but not to programming.


HTML is a markup language, nothing to do with programming.

> <div class="s1">
> <p><a href="one.htm">One</a></p>
> <p><a href="two.htm">Two</a></p>
> <p><a href="three.htm">Three</a></p>
> <p><a href="four.htm">Four</a></p>
> </div>


That's a list of links, not paragraphs, mark them up appropriately.

--
Spartanicus
 
Reply With Quote
 
Si
Guest
Posts: n/a
 
      05-22-2005
Hortich wrote:

snip
I
> think I want to take the code above and put it in a file called
> "common.htm", then in each of my 36 other HTML pages I want to say something
> like @import "common.htm". I then change my file "common.htm" once and all
> the changes are replicated in all 36 other pages.


If you server supports include files and most do, you can rename your
html to shtml or asp etc then use the include virtual or file to include
your common.htm file. Use the include in place of your code.

The syntax is as follows

<!--#include virtual="/common.htm"--> for absolute paths

or

<!--#include file="common.htm"--> for relative paths.

HTH, Simon




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
to use import java.lang.* or import java.lang.Math or none at all? JPractitioner Java 13 02-24-2006 08:48 PM
XML Schema question - does "import" import elements? Vitali Gontsharuk XML 2 08-25-2005 07:33 PM
IMPORT STATIC; Why is "import static" file scope? Why not class scope? Paul Opal Java 12 10-10-2004 11:01 PM
GTK import doesn't import first time Dennis Python 2 08-18-2003 10:00 PM
import/from import question Artur M. Piwko Python 1 07-02-2003 07:04 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57