i have tried including the contents of a .txt file into a cgi page, and that works. but now i am trying to do sumthing a bit diffrent. i am trying to include the contents of a .shtml into a cgi page. what i get as the output is the contents of the shtml page are outputted but the <!--#include virtual.... doesnt seem to work. i have written the whole path starting from /home/www/.... in the include directive. i have tried replacing include virtual with include file also. but no luck. the output is there but the contents of the file which i have included in the ssi directive are missing on the page when i see it on the browser. i dont want to write the relative path since i dont know from which directory my cgi page will be run by the webserver. thanx...... ketaki update: i am not writting the include command directly in the cgi page (local.cgi). this include command is in the file called forcgi.shtml. And the contents of the file forcgi.shtml are being outputted by the cgi page by file handling. heres my code: heres my code:

#!/usr/bin/perl use lib '/home/www/xxxxxxxxxxxx.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 +xxxxxxx' Yahoo Group</a> <br><br><a href="">Upload the latest Info Sheet</a><br><br> <form method="post" action="http://xxxxxxxxxxxxxxxxxx.org/cgi-bin/loca +l.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://xxxxxxxxxxxxxx.org/cgi-bin/local.cgi">back to +local information home page</a> htmlx } local $/ = undef; open(file, "/home/www/xxxxxxxxxxxxxxx.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://xxxxxxxxxxxxxxxxxx.org/styles/style1.css" rel= "sty +lesheet" 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

In reply to including the content of a .shtml file into a cgi page by ketaki

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.