[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] file uploads



At 2:46 PM 12/18/00, EaTrom wrote:
>I have a client that we are trying to do something similar.
>
>>From their public index.html page, there is a segment that will display the
>heading and link to a news article. I am using perl to take the info from
>the backend form page and generate the appropriate html for this snippet.
>This cgi will reside on a private server so only the client (and us) have
>access to it.
>
>My query is: is there a way to dynamically include that snippet into the
>index.html without generating the index.html file each time? My alternative
>at the moment is to use a frame holding the top pane of the index.html which
>will reside on the private server and the bottom pane on the public server.
>Then, whenever the news clipping is updated, the frame will be able to
>display the newer version.
>
>Any pointers??

First, it's no big deal to have a script re-write the index.html file 
when new dynamic material shows up. Way faster than updating via FTP. 
But since you say this, let me check first: is it OK in your 
situation to have a script write a separate file just holding the 
dynamic snippet? If so, then I'd suggest starting with a Server-Side 
Include (SSI) as a means of inserting the dynamic material into the 
index.html page. SSI doesn't solve every case like this, but it's 
much simpler than other approaches.

Most web servers can be configured to enable various types of 
"includes" in the HTML they serve up. The server inserts the dynamic 
material into the HTML file when it reads/copies the file to send on 
to the client (web browser).

The simplest would be the following, placed in your index.html file 
where you want the dynamic material to appear:

<!--#include file="snippet.txt"-->

You'll save time by asking your sys admin what the web server's 
config is for SSI. Not all SSI commands are routinely enabled, 
although "include" is the most common.

Also, some web servers can be configured to only allow SSI if the 
HTML file has the right suffix: .shtml is used on Apache (UNIX) 
servers, .asp on NT, etc. A reason that some sys admins don't enable 
SSI for regular-suffix (.html/.htm) pages is that the web server has 
much more work to do, if it has to parse for includes in every web 
page it serves up. But lots of ISPs running UNIX do enable SSI for 
.html/.htm pages.

There are plenty of ways to generate HTML from CGI scripts, and one 
that might apply here would be to include a call to a script to fetch 
and/or mark up the dynamic material. The call to the script would be 
in an SSI with the command 'exec', a la:

<!--#exec cgi="cgi-bin/snippet_grabber.cgi"-->

The output of the CGI is inserted where the above expression appears 
in the index.html file.

SSI, IMO, is way better than using frames to pull material together 
from different sources. Does this help? If not, describe your 
situation in more detail.

1;

- Bruce

__Bruce_Van_Allen___Santa_Cruz_CA__

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org