Forum Moderators: coopster & phranque

Message Too Old, No Replies

"Includes" in a .pl script

Need to do it, but completely lost as to how

         

MatthewHSE

1:53 pm on Apr 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, I don't know much about server-side programming but it's about time I begin to at least get started. So I thought this would be a good place to start.

I'm using a .pl script on my site. Through the admin panel of the script, I can add a "header" and a "footer" that will appear on the pages the script generates. The generated pages have a .pl file extension, though I could change that to .cgi if necessary. The header and footer are saved as separate files, "1.header" and "1.footer."

My site-wide header and footer are inserted on all my .html pages with SSI. They include a couple rotating banner areas. So I really need to be able to insert "SSI" into the header and/or footer of this script, so the pages it generates will be consistent with the rest of my site.

I tried changing my .htaccess file so that .header and .footer files would be parsed for SSI, hoping the output of those files would then be inserted in the script pages. That didn't work. So does anyone else have some other ideas? I'm waiting on support from the script programmers, but I've been waiting long enough that I don't think they're going to answer this one . . .

Any ideas will be duly tried and appreciated!

Thanks,

Matthew

lexipixel

5:18 am on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is raw, but you'll get the idea.

print "Content type=text/html\n\n";
#
$filename = "/path/to/header.htm";
#
open (HTM,"$filename");
@lines = <HTM>;
close (HTM);
foreach $line (@lines) { print "$line"; }
#
#
# do whatever comes between header and footer
#
#
$filename= "/path/to/footer.htm";
#
open (HTM,"$filename");
@lines = <HTM>;
close (HTM);
foreach $line (@lines) { print "$line"; }
#
exit;
#
# EOF

MatthewHSE

2:38 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops, I should have mentioned that I don't have access to the source code - all I can edit is the .header and .footer files. I can also change whether or not the script uses the .cgi or .pl file extension, and can edit my .htaccess file. Beyond that, I don't have a lot of options here. Do I have enough options to do what I want, and if so, how? Or is this too general of a question?

Thanks,

Matthew

DrDoc

4:30 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do I have enough options to do what I want

My gut feeling answer to your question is -- no.
The header and footer files are not parsed by the server, so SSI won't work. For you to be able to do what you want, the header and footer files must be parsed by Perl. It doesn't seem like they are. If they are not, then you have no choice but to manually put the markup in there.