in reply to Re^3: including the content of a .shtml file into a cgi page
in thread including the content of a .shtml file into a cgi page

heres my code:
#!/usr/bin/perl use lib '/home/www/xxxxxxxxxxxxx.org/modules'; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use warnings; use strict; use diagnostics; use declare_dbh; use CGI::SSI; print CGI::header(); my $body; my $dbh=declare_dbh::dbhandle(); my $step =param('step'); my $area =param('area'); if($step != 2) { $body.=<<htmlx; <a target="_blank" href="http://groups.yahoo.com/group/AOL_Delhi/?v=1& +t=search&ch=web&pub=groups&sec=group&slk=1">Sign up to 'xxxxxxxxxxxxx +xxxxx' Yahoo Group</a> <br><br><a href="">Upload the latest Info Sheet</a><br><br> <form method="post" action="http://xxxxxxxxxxxxxxxxxxxx.org/cgi-bin/lo +cal.cgi"> Give me details for my Area : <select name="area"> <OPTION VALUE="none" SELECTED>Select an area</OPTION> <option value="505 A B WORKSHOP">505 A B WORKSHOP</option> <option value="A F PALAM">A F PALAM</option> <option value="A F RAJOKARI">A F RAJOKARI</option> <option value="A.G.C.R.">A.G.C.R.</option> <option value="A-3 JANAK PURI">A-3 JANAK PURI</option> <option value="ADRASH NAGAR">ADRASH NAGAR</option> <option value="AIR FORCE STATION TUGALKABAD">AIR FORCE STATION + TUGALKABAD</option> <option value="AJMERI GATE EXTN.">AJMERI GATE EXTN.</option> <option value="ALAKNANDA">ALAKNANDA</option> <option value="ALIGANJ">ALIGANJ</option> <option value="ALIPUR">ALIPUR</option> <option value="AMAR COLONY">AMAR COLONY</option> <option value="AMRIT KAUR MARKET">AMRIT KAUR MARKET</option> <option value="ANAND NIKETAN">ANAND NIKETAN</option> <option value="ANAND PARBAT INDL. AREA">ANAND PARBAT INDL. ARE +A</option> <option value="ANAND PARBAT PO">ANAND PARBAT PO</option> <option value="ANAND VIHAR">ANAND VIHAR</option> <option value="ANANDWAS">ANANDWAS</option> <option value="ANARKALI">ANARKALI</option> <option value="ANDREWSGANJ">ANDREWSGANJ</option> </select> <input type="hidden" name="step" value="2"> <input type="submit" value="Go"> </form> <br><br> In the news : <br><br> <a href="">Upcoming events in Delhi/NCR</a> <br><br>Delhi Central Office:<br><br> htmlx } else { my $sth= $dbh->prepare("select * from chapters where Chapter_name=?"); $sth->execute($area); if ($sth->rows > 0) { $body.= <<htmlx; $area Chapter Information Page:<br><br><br> <br>contact numbers: <br>website : <br>regular followups : <br>sheduled date for next course : <br>recent updates : <br>upcoming events : <br><br><a href="">update chapter info</a> htmlx } else { $body.= "<br><br><br>Sorry, no information for your area is availa +ble yet!" } $body.= <<htmlx; <br><br><a href="http://xxxxxxxxxxxxxxx.org/cgi-bin/local.cgi">back to + local information home page</a> htmlx } local $/ = undef; open(file, "/home/www/xxxxxxxxxxxxxxxx.org/forcgi.shtml"); my $filedata= <file>; $filedata =~ s/\$body/$body/; close(file); print $filedata;
and below is the code in forcgi.shtml page:
<html> <head> <title></title> <link href="http://xxxxxxxxxxxxxxxxxxxxx.org/styles/style1.css" rel= " +stylesheet" type="text/css"> </head> <body> <br><br> <!--#include virtual="frame.txt" --> <br><br> <center> <div style="margin:0 auto;width:750px;height:420px;"> $body </div> </center> <!--#include virtual="frame_bottom.txt" --> </body> </html>
and the contents of frame.txt are not being displyed when i view the cgi page online. thanx ketaki

Replies are listed 'Best First'.
Re^5: including the content of a .shtml file into a cgi page
by moritz (Cardinal) on Jul 15, 2008 at 09:01 UTC
    Simply use'ing the module isn't enough. The documentation lists several possibilities to actually use its functionality.
      i read the documentation. what i gathered from it is dat cgi::ssi is for writing include commands directly in the cgi script. but my aim is to output the results of a processed .shtml into the output of the cgi script.
        CGI::SSI does that:
        $ perl -e 'use CGI::SSI (autotie => "STDOUT"); print qq{<!--#echo var= +"DATE_LOCAL" -->\n}' Tue Jul 15 11:30:56 2008