Simple html include?

C

Crappola 308

Hi everyone,

I have a small problem with my web site and though I'd ask here first. I suspect
it's a fairly common problem, now that I read a bit about it.

All my pages are .html 4.01 pages. Every page on my site has 4 scripts. A js for
StatCounter which counts visitors, a js for a small widget which shows online
visitors, some regular html code for the valid HTML 4.01 tag (that's not
actually js, but the usual html validation referrer code for W3) and a js for
Google analytics. The scripts are distributed like this. Google wants their
script just before </head>.

<html>
<head>
..css
google.js
</head>

<body>
....
statcounter.js
widget.js
w3.html
</body>

I was thinking that maybe it would be a good idea to "extract" all those pieces
of code, put them all in some higher directory and load them dynamically as
includes on every page. I am basically cluless on html, so I searched the net
and found that there are several solutions to this.

The easier seems to be Server Side Includes (SSI), using something like:

<html>
<head>
..css
<--#include virtual="http://www.xxx.com/js/google.html"--->
</head>
<body>
....
<--#include virtual="http://www.xxx.com/js/statcounter.html"--->
<--#include virtual="http://www.xxx.com/js/widget.html"--->
<--#include virtual="http://www.xxx.com/js/w3.html"--->
</body>

It looks elegant, too. BUT: In order to do this, I have to do either:

include a .htaccess file which enables SSI on my domain provider (yahoo
webhosting) for my directories. I tried uploading one such file to my main web
hosting directory, but I got a message saying something like "forbidden, stay in
your directory only". So this is out.

Second solution: Assuming the yahoo host activates SSI with .shhtp (some servers
do?) I could conceivably change all my pages to .shttp, but this is no go,
because the web site has over 250 pages with many links already hardcoded
outside my site. Also, I tried it on one page and it doesn't work. Solutions
which will force me to change the page type are out.

..php solutions also require me to change the type of web pages, so these are
out.

I also tried the following pseudo-include:

<script type="text/javascript"
src="http://www.xxx.com/js/statcounter.html"></script>

Doesn't work either.

The yahoo hosting representatives are fairly clueless about all this. I just
need a simple html include, to eliminate around 250 repeated instances of the
same quadruple code on my web site. Nothing more, nothing less.

Is there a solution for this or am I searching in vain?

Thanks
 
R

richard

Hi everyone,

I have a small problem with my web site and though I'd ask here first. I suspect
it's a fairly common problem, now that I read a bit about it.

All my pages are .html 4.01 pages. Every page on my site has 4 scripts. A js for
StatCounter which counts visitors, a js for a small widget which shows online
visitors, some regular html code for the valid HTML 4.01 tag (that's not
actually js, but the usual html validation referrer code for W3) and a js for
Google analytics. The scripts are distributed like this. Google wants their
script just before </head>.

<html>
<head>
.css
google.js
</head>

<body>
...
statcounter.js
widget.js
w3.html
</body>

I was thinking that maybe it would be a good idea to "extract" all those pieces
of code, put them all in some higher directory and load them dynamically as
includes on every page. I am basically cluless on html, so I searched the net
and found that there are several solutions to this.

The easier seems to be Server Side Includes (SSI), using something like:

<html>
<head>
.css
<--#include virtual="http://www.xxx.com/js/google.html"--->
</head>
<body>
...
<--#include virtual="http://www.xxx.com/js/statcounter.html"--->
<--#include virtual="http://www.xxx.com/js/widget.html"--->
<--#include virtual="http://www.xxx.com/js/w3.html"--->
</body>

It looks elegant, too. BUT: In order to do this, I have to do either:

include a .htaccess file which enables SSI on my domain provider (yahoo
webhosting) for my directories. I tried uploading one such file to my main web
hosting directory, but I got a message saying something like "forbidden, stay in
your directory only". So this is out.

Second solution: Assuming the yahoo host activates SSI with .shhtp (some servers
do?) I could conceivably change all my pages to .shttp, but this is no go,
because the web site has over 250 pages with many links already hardcoded
outside my site. Also, I tried it on one page and it doesn't work. Solutions
which will force me to change the page type are out.

.php solutions also require me to change the type of web pages, so these are
out.

I also tried the following pseudo-include:

<script type="text/javascript"
src="http://www.xxx.com/js/statcounter.html"></script>

Doesn't work either.

The yahoo hosting representatives are fairly clueless about all this. I just
need a simple html include, to eliminate around 250 repeated instances of the
same quadruple code on my web site. Nothing more, nothing less.

Is there a solution for this or am I searching in vain?

Thanks

Have you looked at perhaps using the <link> tag?
 
R

richard

Hi everyone,

I have a small problem with my web site and though I'd ask here first. I suspect
it's a fairly common problem, now that I read a bit about it.

All my pages are .html 4.01 pages. Every page on my site has 4 scripts. A js for
StatCounter which counts visitors, a js for a small widget which shows online
visitors, some regular html code for the valid HTML 4.01 tag (that's not
actually js, but the usual html validation referrer code for W3) and a js for
Google analytics. The scripts are distributed like this. Google wants their
script just before </head>.

<html>
<head>
.css
google.js
</head>

<body>
...
statcounter.js
widget.js
w3.html
</body>

I was thinking that maybe it would be a good idea to "extract" all those pieces
of code, put them all in some higher directory and load them dynamically as
includes on every page. I am basically cluless on html, so I searched the net
and found that there are several solutions to this.

The easier seems to be Server Side Includes (SSI), using something like:

<html>
<head>
.css
<--#include virtual="http://www.xxx.com/js/google.html"--->
</head>
<body>
...
<--#include virtual="http://www.xxx.com/js/statcounter.html"--->
<--#include virtual="http://www.xxx.com/js/widget.html"--->
<--#include virtual="http://www.xxx.com/js/w3.html"--->
</body>

It looks elegant, too. BUT: In order to do this, I have to do either:

include a .htaccess file which enables SSI on my domain provider (yahoo
webhosting) for my directories. I tried uploading one such file to my main web
hosting directory, but I got a message saying something like "forbidden, stay in
your directory only". So this is out.

Second solution: Assuming the yahoo host activates SSI with .shhtp (some servers
do?) I could conceivably change all my pages to .shttp, but this is no go,
because the web site has over 250 pages with many links already hardcoded
outside my site. Also, I tried it on one page and it doesn't work. Solutions
which will force me to change the page type are out.

.php solutions also require me to change the type of web pages, so these are
out.

I also tried the following pseudo-include:

<script type="text/javascript"
src="http://www.xxx.com/js/statcounter.html"></script>

Doesn't work either.

The yahoo hosting representatives are fairly clueless about all this. I just
need a simple html include, to eliminate around 250 repeated instances of the
same quadruple code on my web site. Nothing more, nothing less.

Is there a solution for this or am I searching in vain?

Thanks

BTW, to use the php stuff, it is necessary that you have php on the server.
Then you must name the files as "php" not html.
 
J

Jonathan N. Little

richard said:
BTW, to use the php stuff, it is necessary that you have php on the server.
True.

Then you must name the files as "php" not html.

Not true. Server setup dependent. Also the files could be named with
extension '.php' with the URL having the "extension" '.html'. There are
several ways to accomplish that.
 
C

Crappola 308

Sherm said:
That message strongly implies that you were *not*, in fact, trying to
upload to your own web hosting space.

sherm--

The yahoo web hosting server won't allow me to upload a file named like that
(.htaccess). Says, "invalid file name". If I upload it named x.htaccess for
example and then try to rename, it won't let me rename it. Says "illegal file
name".
 
A

Adrienne Boswell

Not true. Server setup dependent. Also the files could be named with
extension '.php' with the URL having the "extension" '.html'. There
are several ways to accomplish that.

The OP mentioned something about being hosted at Yahoo. They don't allow
an htaccess file, so in the OP's case, it would have to be so named. I
ran into this recently when I switched a client from HTML to PHP and
tried to use htaccess to redirect to the new files. Yahoo doesn't allow
it for "security" reasons, although they are running PHP 4.3.11 with
Registered Globals on.

My suggestion to the OP is to run away from Yahoo as fast as possible.
 
D

dorayme

richard said:
BTW, to use the php stuff, it is necessary that you have php on the server.
Then you must name the files as "php" not html.

Not quite the last bit. You can have .html files parsed for php.
 
D

Denis McMahon

Is there a solution for this or am I searching in vain?

There is a solution, yes. Pay for a web hosting service that allows ssi.

I'm pretty sure that the basic problem you're having with ssi at the
moment is that your hosting service doesn't support it.

Rgds

Denis McMahon
 
D

Denis McMahon

So far so good...


No, not correct. I could name them .blah if I really wanted to.

Of course, what should I expect from you? You think you can't use
.htaccess on Windows, so...

Actually the OP needs to name the files as whatever is appropriate to
have the web server parse them the way he wants.

If the server is only set up to parse *.php as php, then he has to name
them php.

If the server is set up so that other file names get parsed as php, he
could use one of those instead.

Inserting a php include into an html file eg:

<?php include("filename.ext") ?>

will only work if php processing is being applied to html files, and
that's a server configuration issue.

If it doesn't work because the server isn't configured for it, then as
he can't use ".htaccess" files to affect the server configuration, he
either needs to get the server global config changed, get his customer
specific config changed, or rename the files as php so they get parsed
as php.

Rgds

Denis McMahon
 
J

Jonathan N. Little

Adrienne said:
The OP mentioned something about being hosted at Yahoo. They don't allow
an htaccess file, so in the OP's case, it would have to be so named.

As I said "Server setup dependent"
I
ran into this recently when I switched a client from HTML to PHP and
tried to use htaccess to redirect to the new files. Yahoo doesn't allow
it for "security" reasons, although they are running PHP 4.3.11 with
Registered Globals on.

Riiiiiight. I bet it is another reason ;-)
My suggestion to the OP is to run away from Yahoo as fast as possible.

I seconded that.
 
C

Captain Paralytic

Actually the OP needs to name the files as whatever is appropriate to
have the web server parse them the way he wants.

If the server is only set up to parse *.php as php, then he has to name
them php.

If the server is set up so that other file names get parsed as php, he
could use one of those instead.

Inserting a php include into an html file eg:

<?php include("filename.ext") ?>

will only work if php processing is being applied to html files, and
that's a server configuration issue.

If it doesn't work because the server isn't configured for it, then as
he can't use ".htaccess" files to affect the server configuration, he
either needs to get the server global config changed, get his customer
specific config changed, or rename the files as php so they get parsed
as php.

Rgds

Denis McMahon

And of course the ".htaccess" file doesn't even need to be
called .htaccess.
 
D

Denis McMahon

And of course the ".htaccess" file doesn't even need to be
called .htaccess.

Well, yes, again that is down to the server configuration.

It sounds to me as if the yahoo server configuration is pretty anal to
be honest, most sensible hosting companies are probably on php 5.2 by
now, and allow some configuration directives to be set in .htaccess.

Rgds

Denis McMahon
 
B

Beauregard T. Shagnasty

Denis said:
It sounds to me as if the yahoo server configuration is pretty anal to
be honest, most sensible hosting companies are probably on php 5.2 by
now, and allow some configuration directives to be set in .htaccess.

Actually, it boils down to "yahoo is not a hosting company" but merely a
file-space place users can upload simple HTML files, just like many ISPs
give their users. No server-side capabilities.
 
D

Denis McMahon

Actually, it boils down to "yahoo is not a hosting company" but merely a
file-space place users can upload simple HTML files, just like many ISPs
give their users. No server-side capabilities.

Oh? I thought someone said that php 4.x was available?

Rgds

Denis McMahon
 
B

Beauregard T. Shagnasty

Denis said:
Oh? I thought someone said that php 4.x was available?

I was only relaying what someone told me last year. Looking for
specifics .. webhosting.yahoo.com .. one needs an account to get past a
login page.
 
R

richard

Hi everyone,

I have a small problem with my web site and though I'd ask here first. I suspect
it's a fairly common problem, now that I read a bit about it.

All my pages are .html 4.01 pages. Every page on my site has 4 scripts. A js for
StatCounter which counts visitors, a js for a small widget which shows online
visitors, some regular html code for the valid HTML 4.01 tag (that's not
actually js, but the usual html validation referrer code for W3) and a js for
Google analytics. The scripts are distributed like this. Google wants their
script just before </head>.

<html>
<head>
.css
google.js
</head>

<body>
...
statcounter.js
widget.js
w3.html
</body>

I was thinking that maybe it would be a good idea to "extract" all those pieces
of code, put them all in some higher directory and load them dynamically as
includes on every page. I am basically cluless on html, so I searched the net
and found that there are several solutions to this.

The easier seems to be Server Side Includes (SSI), using something like:

<html>
<head>
.css
<--#include virtual="http://www.xxx.com/js/google.html"--->
</head>
<body>
...
<--#include virtual="http://www.xxx.com/js/statcounter.html"--->
<--#include virtual="http://www.xxx.com/js/widget.html"--->
<--#include virtual="http://www.xxx.com/js/w3.html"--->
</body>

It looks elegant, too. BUT: In order to do this, I have to do either:

include a .htaccess file which enables SSI on my domain provider (yahoo
webhosting) for my directories. I tried uploading one such file to my main web
hosting directory, but I got a message saying something like "forbidden, stay in
your directory only". So this is out.

Second solution: Assuming the yahoo host activates SSI with .shhtp (some servers
do?) I could conceivably change all my pages to .shttp, but this is no go,
because the web site has over 250 pages with many links already hardcoded
outside my site. Also, I tried it on one page and it doesn't work. Solutions
which will force me to change the page type are out.

.php solutions also require me to change the type of web pages, so these are
out.

I also tried the following pseudo-include:

<script type="text/javascript"
src="http://www.xxx.com/js/statcounter.html"></script>

Doesn't work either.

The yahoo hosting representatives are fairly clueless about all this. I just
need a simple html include, to eliminate around 250 repeated instances of the
same quadruple code on my web site. Nothing more, nothing less.

Is there a solution for this or am I searching in vain?

Thanks

Found the answer.
The trick is to use <span> and display:inline-block;.
 
K

Kamron Bennett

Why would he look at something that has *nothing* to do with what he's
trying to accomplish?

Some serious advice: Learn first. Then teach. Trying to do it the other
way around makes you look stupid.

sherm--

If you are not answering the question - shut up! You are rude obnoxious
goat. What's with the "chip on the shoulder" attitude? And I know I'm
not answering the question either but it "gets my goat" the way you just
go around insulting people. What is it - do you want people to beg you
for the answer?

If you have nothing to say, do exactly that - say nothing!
 
D

dorayme

Evan Platt said:
Pretty pathetic that he has to keep creating sock puppets like that.

No more than people who do not create them, going by the postings
of this little gang of Richard watchers.
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top