Results 1 to 9 of 9
Thread: Enable SSI for cgi-scripts...
-
05-28-2001, 12:32 PM #1Web Hosting Evangelist
- Join Date
- Dec 2000
- Posts
- 542
Enable SSI for cgi-scripts...
How can I do so?
-
05-28-2001, 12:45 PM #2WHT Addict
- Join Date
- Dec 2000
- Location
- Miami, Florida
- Posts
- 100
I don't think that's possible. However there is a way. And I use it for my estimate script (http://www.dim8.net/cgi-bin/estimate.pl).
All I do is where I want a txt file to be inserted, I use this code:
open(INF,"menu.txt") or dienice("Can't open menu.txt: $!");
@ary = <INF>;
close(INF);
foreach $line (@ary) {
chomp($line);
print "$line";
}
And it adds the menu.txt file right where I want it. =0Robert C. Rodriguez
Dimension 8 WebHosting - http://www.dim8.net
Hosting For The New Dimension!
robert@dim8.net
-
05-28-2001, 01:21 PM #3Newbie
- Join Date
- May 2001
- Location
- West Lafayette, IN
- Posts
- 22
Ditto, its not possible (at least I am fairly certain). You could write or find a SSI parser for perl/python/[insert your favorite scripting language here] instead.
Regardless, why would you want to use SSI when you are using a CGI script? Its just easier to let the script take care of that stuff instead...- Matt Wirges
http://www.sharpwebinnovations.com/
sysadmin@sharpwebinnovations.com
Nil novi sub solo.
-
05-28-2001, 01:35 PM #4Web Hosting Master
- Join Date
- Dec 2000
- Posts
- 1,280
The above code is good, but here's an even better one..
put this code at the end of your CGI script.
Code:sub rFile { if(-f $_[0]) { open(FILE, $_[0]) || die "Could not open $_[0] : $!"; while(<FILE>) { print $_; } close(FILE); } else { die "$_[0] does not exist"; } }
Code:&rFile("dir/file.txt");
Saeed(SH)Saeed
-
05-28-2001, 02:05 PM #5WHT Addict
- Join Date
- Dec 2000
- Location
- Miami, Florida
- Posts
- 100
Yeep.. that code is much better. It's much easier for me to add only 1 line of coding to have a file inserted than using that code. Thanks for the code.. I've changed my scripts to start using that code! =0
Robert C. Rodriguez
Dimension 8 WebHosting - http://www.dim8.net
Hosting For The New Dimension!
robert@dim8.net
-
05-28-2001, 02:17 PM #6Web Hosting Master
- Join Date
- Dec 2000
- Posts
- 1,280
I'm glad I could help, feel free to email me if you need other programming/database work done.
(SH)Saeed
-
05-28-2001, 02:25 PM #7Web Hosting Evangelist
- Join Date
- Dec 2000
- Posts
- 542
Thanks pal. Actually my client asked for it. I don' t know he want to use it, but it's just not my business.
-
06-13-2001, 03:23 PM #8WHT Addict
- Join Date
- Jul 2000
- Location
- Switzerland
- Posts
- 100
With Apache 2 it is possible, but it is still beta.
Apache modules may now be written as filters which act on the stream of content as it is delivered to or from the server. This allows, for example, the output of CGI scripts to be parsed for Server Side Include directive by mod_include.[ voodooweb hosting ]
hosting@voodooweb.com
Internet Solutions made in Switzerland
-
06-14-2001, 08:50 AM #9I Squash Server Problems
- Join Date
- Apr 2001
- Location
- FL, USA
- Posts
- 949
FastTemplate.pm
Check into a Perl Module called FastTemplate.pm. This module is an OO perl module that can parse HTML template files with variable subsitutions. This may need more than what they need, but FastTemplate.pm is a nice way to seperate your HTML code from the perl code. If you don't need any variable interpolations, then use one of the methods above.
We save you time, money, and frustration by handling the server management tasks required to run an online business successfully.
No prodding required. We just do it right the first time. Red Hat, MySQL, Plesk, and cPanel certified staff.