in reply to Re: 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. i added the use cgi::ssi statement. but it still doesnt seem to work. the cgi file name is local.cgi. the file which i am reading within the local.cgi page is called forcgi.shtml. and the contents of frame.txt are being included in the directive include command written on the forcgi.shtml page. the rest of the contents of the file forcgi.shtml are being displayed, but the include command written on the forcgi.shtml page which includes the contents of frame.txt , doesnt seem to work. so i cant see the contents of frame.txt, on the local.cgi page. the problem could even be the virtual or file tag, in the include command on the forcgi.shtml page. forcgi.shtml and frame.txt are both in the same directory, while the local.cgi page is inside the cgi-bin directory. i dont even know from which directory my webserver runs my cgi pages. thanx... ketaki
  • Comment on Re^2: including the content of a .shtml file into a cgi page

Replies are listed 'Best First'.
Re^3: including the content of a .shtml file into a cgi page
by Corion (Patriarch) on Jul 15, 2008 at 08:45 UTC

    If you don't know what webserver you're running, how are we supposed to know?

    Also, "doesn't seem to work" is not a very specific error description.

    See How (Not) To Ask A Question

Re^3: including the content of a .shtml file into a cgi page
by moritz (Cardinal) on Jul 15, 2008 at 08:46 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.
      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.