PDA

View Full Version : Server Side Includes


Corbbmacc O'Connor
09-01-2000, 11:49 PM
Hello everybody,
I'm creating a web site and want to use Server Side Includes. However, the CGI database I'm using does not support SSI. My question is are there any ways to simulate SSI without having to having to actually use SSI?

------------------
Best Regards,
Corbbmacc O'Connor
Head Webmaster
http://www.JustForWebmasters.com

Jacob
09-02-2000, 05:28 PM
Dear Sir,
First of all, SSI is designed for HTML pages. Trying to use SSI in CGI applications would defeat the purpose of SSI.

Please post more information on what you are trying to do. Please include any links that may help me answer your question.

Regards,

------------------
Jacob A. Wheeler
Co-Founder / Web Engineer
Big Resources Network
jacob@bigresources.com
ICQ: 390147 (http://www.icq.com/390147)

Henrik
09-03-2000, 02:05 AM
The reason why SSI does not work with CGI output is that it is disabled for security reasons. It might be possible in the future though, when/if the security problems has been solved. It would not defeat the purpose of SSI to use it in CGI applications, there is no difference between HTML files and HTML output from CGI's.

There are workarounds however. I have written my own SSI parser in perl and I use it whenever I have SSI contents in the output of the CGI script. It is a powerful feature since I can use the same templates for HTML-pages and for CGI applications without changing a thing.
I don't know how your script is built. But if it's built using HTML-templates it should be pretty easy to add an SSI parser to it. If you send me the sourcecode of your CGI-application I will take a look at it and see if I can add an SSI parser for you. My e-mail is: rain@myself.com

Regards,
Henrik

Jacob
09-03-2000, 11:44 AM
Henrik,

Maybe I'm confused here, but for doing the following:

<!--#include file="blah.html" -->

Why would you be using the above in a Cgi-Application? When you could substitute the above with something like @blah, which contains blah.html (inputed earlier) ?

Regards,


------------------
Jacob A. Wheeler
Co-Founder / Web Engineer
Big Resources Network
jacob@bigresources.com
ICQ: 390147 (http://www.icq.com/390147)

Corbbmacc O'Connor
09-03-2000, 03:13 PM
Dear Henrik,
What is your e-mail address? My CGI script does use HTML templates.

------------------
Best Regards,
Corbbmacc O'Connor
Head Webmaster
http://www.JustForWebmasters.com

Corbbmacc O'Connor
09-03-2000, 03:15 PM
Hi everybody,
Please ignore the last post. When I was reading Henrik's post, I skipped over the e-mail address.

------------------
Best Regards,
Corbbmacc O'Connor
Head Webmaster
http://www.JustForWebmasters.com

Henrik
09-03-2000, 07:51 PM
Jacob,

Using SSI in the HTML-templates makes things a lot eaiser. A couple of examples:

1.) You want to insert a new html-file blah.html in your template. Without SSI you would probably have to edit the cgi-application so that it loads blah.html and inserts it in the output. If you don't have a clue about how perl works this can be a hard task(and even if you have that knowledge it is more work than needed). If the cgi-app uses the SSI-parser i wrote you just have to write <!--#include file="blah.html"--> in the HTML-template and the parser will include the file in the output, and you won't have to do anything.
2.) You use a lot of cgi-applications inserted in your html-pages, banner rotators, news-scripts, polls etc.. Lets say you have a banner rotator that you include using SSI in your html-files, like this <!--#include virtual="/cgi-bin/ads/ads.cgi"-->. How would you insert that one into a CGI-applications output? If you write the SSI include in the HTML-template nothing will happend as this feature is turned off in the web-server when you use CGI's. There are a few solutions to this, however all of them requires you to write a lot of code. If you use my SSI parser you just have to put <!--#include virtual="/cgi-bin/ads/ads.cgi"--> into your HTML-template and the parser will run the banner-rotator script and insert its output in the actual CGI-output.

The nice thing about this is that it requires no knowledge of perl. You can use the same SSI-includes all over your site so it is easy to manage it without having to bother looking into the CGI's. It's also a lot more structured.

I don't know if this gave you a better explanation why you would want to use SSI in your CGI's. If not, tell me and i'll explain more.

I will probably make a perl module of my parser in the near future(when I can find some time), making it a lot easier to include it in the CGI's and i'll also add a lot more functions to it.

Regards,
Henrik