CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Using require/SSI in CGI scripts

 



zaro
Deleted

Dec 14, 2000, 2:17 PM

Post #1 of 4 (560 views)
Using require/SSI in CGI scripts Can't Post

First, is there a way to insert a plain text file into CGI output similar to the SSI include statement? For example, the contents of my.txt embedded into the html output.

Second, I know that certain SSI statements can be embedded into cgi scipts using $ADVNoPrint = 1; $ADVQuery = ""; and a require statement. However, is there a way to get SSI include (virtual or not) to work?

Regards,

zaro



sleuth
Enthusiast / Moderator

Dec 14, 2000, 11:52 PM

Post #2 of 4 (555 views)
Re: Using require/SSI in CGI scripts [In reply to] Can't Post

 
Yes there is, but I'm confused by your explanations with SSI, What are you tyring to do?

Sleuth



zaro
Deleted

Dec 15, 2000, 6:57 AM

Post #3 of 4 (552 views)
Re: Using require/SSI in CGI scripts [In reply to] Can't Post

In a regular html page I have two "include virtual" SSIs, one pulls the content of a txt file into the page the other runs a search.cgi on a database and pulls/displays the results in the page.

Now, I would like to do the same for a cgi generated page. Is there a way to "include" external content, as described above, in cgi generated pages?

Regards,

zaro



japhy
Enthusiast

Dec 15, 2000, 3:30 PM

Post #4 of 4 (548 views)
Re: Using require/SSI in CGI scripts [In reply to] Can't Post

CGI program cannot produce SSI directives -- at least, it can, but the server will not parse the directives.

It is silly, though, for a CGI program to rely on SSI -- there shouldn't be anything you need to use SSIs for in a CGI program. If you want to include a file as output, merely open it and print its contents:


Code
open FILE, "file/to/read.txt" or die "can't read file/to/read.txt: $!"; 
print while <FILE>;
close FILE;

The other SSI directives have pretty simple translation into the general algorithm behind them, and they're pretty easy to implement in Perl.

Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives