Simple html include?

Discussion in 'HTML' started by Crappola 308, Feb 12, 2011.

  1. Crappola 308

    Crappola 308 Guest

    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
     
    Crappola 308, Feb 12, 2011
    #1
    1. Advertising

  2. Crappola 308

    richard Guest

    On Sun, 13 Feb 2011 01:44:00 +0200, Crappola 308 wrote:

    > 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?
     
    richard, Feb 13, 2011
    #2
    1. Advertising

  3. Crappola 308

    richard Guest

    On Sun, 13 Feb 2011 01:44:00 +0200, Crappola 308 wrote:

    > 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.
     
    richard, Feb 13, 2011
    #3
  4. richard wrote:

    > 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.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Feb 13, 2011
    #4
  5. Crappola 308

    Crappola 308 Guest

    Sherm Pendley wrote:
    > "Crappola 308" <> writes:
    >
    >> 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".

    >
    > 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".
     
    Crappola 308, Feb 13, 2011
    #5
  6. Gazing into my crystal ball I observed "Jonathan N. Little"
    <> writing in
    news:ij7ao5$drt$-september.org:

    > richard wrote:
    >
    >> 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.
    >


    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.

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne Boswell, Feb 13, 2011
    #6
  7. Crappola 308

    dorayme Guest

    In article <>,
    richard <> wrote:

    > 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.

    --
    dorayme
     
    dorayme, Feb 13, 2011
    #7
  8. On 12/02/11 23:44, Crappola 308 wrote:

    > 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
     
    Denis McMahon, Feb 13, 2011
    #8
  9. On 13/02/11 01:16, Evan Platt wrote:
    > On Sat, 12 Feb 2011 17:52:30 -0700, richard <>
    > wrote:
    >
    >> BTW, to use the php stuff, it is necessary that you have php on the server.

    >
    > So far so good...
    >
    >> Then you must name the files as "php" not html.

    >
    > 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
     
    Denis McMahon, Feb 13, 2011
    #9
  10. Adrienne Boswell wrote:
    > Gazing into my crystal ball I observed "Jonathan N. Little"
    > <> writing in
    > news:ij7ao5$drt$-september.org:
    >
    >> richard wrote:
    >>
    >>> 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.
    >>

    >
    > 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.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Feb 13, 2011
    #10
  11. On Feb 13, 4:32 am, Denis McMahon <>
    wrote:
    > On 13/02/11 01:16, Evan Platt wrote:
    >
    > > On Sat, 12 Feb 2011 17:52:30 -0700, richard <>
    > > wrote:

    >
    > >> BTW, to use the php stuff, it is necessary that you have php on the server.

    >
    > > So far so good...

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

    >
    > > 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


    And of course the ".htaccess" file doesn't even need to be
    called .htaccess.
     
    Captain Paralytic, Feb 13, 2011
    #11
  12. On 13/02/11 12:49, Captain Paralytic wrote:

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


    > 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
     
    Denis McMahon, Feb 13, 2011
    #12
  13. Denis McMahon wrote:

    > 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.

    --
    -bts
    -Four wheels carry the body; two wheels move the soul
     
    Beauregard T. Shagnasty, Feb 13, 2011
    #13
  14. On 13/02/11 19:28, Beauregard T. Shagnasty wrote:
    > Denis McMahon wrote:
    >
    >> 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.


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

    Rgds

    Denis McMahon
     
    Denis McMahon, Feb 14, 2011
    #14
  15. Denis McMahon wrote:

    >Beauregard T. Shagnasty wrote:
    >> Denis McMahon wrote:
    >>> 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.

    >
    > 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.

    --
    -bts
    -Four wheels carry the body; two wheels move the soul
     
    Beauregard T. Shagnasty, Feb 14, 2011
    #15
  16. Crappola 308

    richard Guest

    On Sun, 13 Feb 2011 01:44:00 +0200, Crappola 308 wrote:

    > 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;.
     
    richard, Feb 15, 2011
    #16
  17. On 15/02/11 19:57, richard wrote:

    >> 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.


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


    Nope. Not even close.

    Rgds

    Denis McMahon
     
    Denis McMahon, Feb 15, 2011
    #17
  18. On 02/12/2011 11:04 PM, Sherm Pendley wrote:
    > richard<> writes:
    >
    >> On Sun, 13 Feb 2011 01:44:00 +0200, Crappola 308 wrote:
    >>
    >>> 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.

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

    >
    > 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!
     
    Kamron Bennett, Feb 16, 2011
    #18
  19. Crappola 308

    dorayme Guest

    In article <>,
    Evan Platt <> wrote:

    > 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.

    --
    dorayme
     
    dorayme, Feb 16, 2011
    #19
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin

    include HTML code from html page

    Kevin, Sep 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    756
    Siva M
    Sep 27, 2005
  2. Cloud Burst
    Replies:
    11
    Views:
    1,087
  3. Tom
    Replies:
    8
    Views:
    714
    Adrienne Boswell
    Feb 13, 2007
  4. Dale
    Replies:
    3
    Views:
    5,705
  5. Andreas Bogenberger
    Replies:
    3
    Views:
    973
    Andreas Bogenberger
    Feb 22, 2008
Loading...

Share This Page