CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Need Help with a little script

 



crashinto
Novice

Jan 20, 2001, 4:58 PM

Post #1 of 2 (276 views)
Need Help with a little script Can't Post

I'm trying to make a script where I can call out using ssi and have templates for my site, for example in test.shtml I use the code for ssi and the url has template.cgi?temp=mainsite. I want it to pull out the header and footer, I got that though. But then I want it to pull out the sub mainsite in between them, but I can not get that to work. Here is the script so far.

#!/usr/bin/perl

#Your Site Title
$config{'sitename'} = 'My Site';

#Your E-mail Address
$config{'email'} = 'myemail@mysite.com';

$config{'header'} =<<"EOF";
<HTML>
<HEAD>
<TITLE>$config{'sitename'}</TITLE>

</HEAD>
<BODY TEXT=#000000 BGCOLOR=#FFFFFF LINK=#000088 VLINK=#000088 ALINK=#000088 MARGINHEIGHT=0 topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">

<TABLE WIDTH=100\% BORDER=0 bordercolor=$config{'colortableborder'} cellspacing=0 cellpadding=0><TR><TD VALIGN=TOP WIDTH=50\%>
<FONT SIZE=+2><A HREF=$ENV{'SCRIPT_NAME'}>$config{'sitename'}</a></FONT>

</TD>

EOF

$config{'footer'} =<<"EOF";
<P>

</BODY>
</HTML>
EOF

#End Config

#START MAIN PROGRAM

print "Content-type: text/html", "\n\n";
print "$config{'header'}";

print $config{'footer'};


---------
Jeremy



pu_nk
journeyman

Jan 21, 2001, 10:22 AM

Post #2 of 2 (265 views)
Re: Need Help with a little script [In reply to] Can't Post

This will take 2 files i think.. You want the foooter in one file and the header in another.... Here are the 2 files you will need to use...

FILE NUMERO UNO.....

#!/usr/bin/perl

#Your Site Title
$config{'sitename'} = 'My Site';

#Your E-mail Address
$config{'email'} = 'myemail\@mysite.com';


print "Content-type: text/html\n\n";

# THE HEADER OF THE PAGE
sub header {
print "<HTML> \n";
print "<HEAD> \n";
print "<TITLE>$config{'sitename'}</TITLE> \n";
print "\n";
print "</HEAD> \n";
print "<BODY TEXT=#000000 BGCOLOR=#FFFFFF LINK=#000088 VLINK=#000088 ALINK=#000088 MARGINHEIGHT=0 topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\"> \n";
print "\n";
print "<TABLE WIDTH=100\% BORDER=0 bordercolor=$config{'colortableborder'} cellspacing=0 cellpadding=0><TR><TD VALIGN=TOP WIDTH=50\%> \n";
print "<FONT SIZE=+2><A HREF=$ENV{'SCRIPT_NAME'}>$config{'sitename'}</a></FONT> \n";
print "\n";
print "</TD> \n";
print "\n";
}

&header;



FROM HERE YOUR MAIL PAGE IS DISPLAIED.
- I will show you the SSI code in a min,


FILE NUMERO 2.....


#!/usr/bin/perl

print "Content-type: text/html\n\n";

#The FOOTER of the PAGE
sub footer {
print "<P> \n";
print "\n";
print "</BODY> \n";
print "\n";

}

&footer;

----------------------------------

so now on your .shtml pages you will want to put the following tags in to run the .pl file via html page..

say you named the first file top.pl
and the second one bottom.pl

Here is the ssi code you will need to do this....

<!--#exec cgi="cgi-bin/top.pl"-->

&lt!--#exec cgi="cgi-bin/bottom.pl"-->

just remember... in this SSI tag you do not put the servers path in there.. you put your VIRTUAL path. So as you can see i used cgi-bin/top.pl
and NOT /usr/home/www/cgi-bin/toppl

hope this helps.

Drew


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives