That a hot trick, Simon.  Appreciate your sharing of it.
But your posting has resurrected a need I've often had with regard to SSI's but
yet been able to do.  Wouldn't it be nice to pass parameters to an SSI
directive, so that (for example) one could print, say only the contacts for
december, like so:

    Apache: <!--#include virtual="/cgi-bin/contacts.cgi?month=12"-->

Usually when I need to pass parameters to an SSI directive, I end up rewriting
it as JavaScript. Can anyone out there enlighten me on how to pass parameters
to an SSI? Or say for sure that there is no possible way.

tom sleckman
cai - san francisco



Simon Oliver wrote:

> Assumning you have SSI setup and working, you simply write CGI scripts that
> query the database and create HTML data islands.  These are then included in
> your documents using SSI directives.
>
> In the HTML document in which you wish to embed the data, include an SSI
> directive pointing to the CGI script that queries the database - the SSI
> syntax varies for different http servers.
>
> Apache: <!--#include virtual="/cgi-bin/contacts.cgi"-->
> IIS: <!--#exec cgi="/cgi-bin/contacts.cgi"-->
>
> This assumes you already have SSI setup and working.
>
> I've attached a simple SSI, DBI, CGI script that genarates a simple HTML
> table.
>
> Let me know how you get on.
>
> --
>   Simon Oliver
>
> #!/usr/bin/perl -Tw
> use strict;
> use DBI;
> print ("Content-Type: text/html\n\n");
>
> my ($dbd, $dsn, $dbh, $sth);
> my ($id, $email, $name);
>
> $dbd = 'ODBC';
> $dsn = 'contact';
> $dbh = DBI->connect("dbi:$dbd:$dsn");
>
> $sth = $dbh->prepare('SELECT contact_id, email, name from contact');
> $sth->execute;
> $sth->bind_columns(\($id, $email, $name));
>
> print qq(<TABLE>);
> print << "EOHTML" while ($sth->fetch);
> <TR>
>     <TD><A HREF="mailto:$email";><IMG SRC="/images/email.gif" BORDER="0"
> ALT="email"></A></TD>
>     <TD><A HREF="/cgi-bin/details.cgi?id=$id">$name</A></FONT></CODE></TD>
> </TR>
> EOHTML
> print "</TABLE>";
>
> $dbh->disconnect;

Reply via email to