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

i dont know if i have apache2. dont know hw to find dat out

Ask your admin.

but it still doesnt seem to work

Show us your code. And read How (Not) To Ask A Question and Writeup Formatting Tips, please.

  • Comment on Re^3: including the content of a .shtml file into a cgi page

Replies are listed 'Best First'.
Re^4: including the content of a .shtml file into a cgi page
by ketaki (Acolyte) on Jul 15, 2008 at 08:56 UTC
    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
      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.
Re^4: including the content of a .shtml file into a cgi page
by ketaki (Acolyte) on Jul 15, 2008 at 11:55 UTC
    hi... when i put in that statement in my cgi file...
    AddOutputFilter INCLUDES.cgi;
    then i get this error: ... Bareword "cgi" not allowed while "strict subs" in use at /home/www/xxxxxxxxxxxxxxxxxxxxxxxxxx.org/cgi-bin/local.cgi line 15. is there any module required. if not then whats the reason? ........ketaki
      That line needs go into your server config or .htaccess file. And please do it by copy and paste.
      A reply falls below the community's threshold of quality. You may see it by logging in.