Wednesday, December 12, 2012

Server Side Includes on Google's web hosting using Google Drive




As a followup to my previous post Google Drive can act as a web server too I ran into a little problem that I still haven't found a solution for.

Here's the background...

I am using Google Drive to host my website on my family genealogy (www.warriner.info).
As on most web sites, there are sections of HTML that are repeated on every page (title bar, menu bar, etc...)  The method I used to achieve this was to use javascript and the "document.writeln" function to generate HTML code dynamically.

It works, but obviously isn't ideal.  I was recently introduced to the concept of Server Side Includes.  For those of you who don't know, this is simply a snippet of HTML code in a separate file on the server.  Then, on your main HTML page, you simply "include" this file.

The syntax for doing this (unless I missed something) is some form of the following:
!-- #include virtual="include/contents.shtml" -->
!-- #include file="/include/title.shtml" -->
(with the appropriate files existing in those locations, of course)

But when I try it on my page, hosted on my Google Drive, this doesn't seem to do anything except show up as a comment in the  HTML.

I posted a question on StackOverFlow here, but didn't get any feedback.

What am I missing? Anyone have any ideas?

Check out my YouTube channel:  www.youtube.com/c/KedarWarriner

4 comments:

  1. Try editing your htaccess file to accept ssi.

    ReplyDelete
    Replies
    1. Yes, I'm aware of that. Except since it's hosted on Google, I don't have access to an htaccess file.

      Delete
  2. It does say that the google drive hosting does not support server-side scripting. https://support.google.com/drive/answer/2881970?hl=en

    ReplyDelete
  3. that code is php, not supported by google drive

    ReplyDelete