Gossamer Forum
Home : General : Perl Programming :

SSI, templates and running perl

Quote Reply
SSI, templates and running perl
I have a Perl script that I run using telnet that creates static HTML pages. I put in a simple SSI for a footer on a template that is used to make some of the pages. Then I run the script and check the Internet and the footer is never their. How do I make sure that the SSI will work? Thanks ahead...
Quote Reply
Re: [Aaron Michael] SSI, templates and running perl In reply to
Quote:
Then I run the script and check the Internet and the footer is never their.

What does View > Source show for the file where you can't see the footer and what is the file extension?

Last edited by:

Paul: Jan 21, 2003, 8:40 AM
Quote Reply
Re: [Paul] SSI, templates and running perl In reply to
The template file extension is .shtml. The code used to call the footer is

<!--#include virtual="footer.htm" -->

So obviously this code is not getting to the outputted shtml pages or I would see the footer after I run the perl from telnet. Do I need to wrap it or parse it or ????

Regular SSI works on my server on regular pages.

Quote Reply
Re: [Aaron Michael] SSI, templates and running perl In reply to
If you are loding the .shtml normally, ie not parsing it through your cgi script, then it looks like it should work fine.

You are going directly to the .shtml file from your browser?

SSI won't work if you are loading the template through your perl script.
Quote Reply
Re: [Paul] SSI, templates and running perl In reply to
Perl script is using the template, which has the incude file. The perl script is creating static shtml pages which is supposed to have the footer on it. You are saying that if perl creates the pages that the SSI won't show up? Is their no way to get around this? That would mean I would have to go and add footers and headers to 30,000 pages after perl uses the template to create them.
Quote Reply
Re: [Aaron Michael] SSI, templates and running perl In reply to
What I mean is that you can't use SSI inside a cgi script, so for example you created a .shtml file with your SSI in it and then did....

Code:
open FILE, "/path/to/include.shtml" or die $!
print while (<FILE>);
close FILE;

...that wouldn't work because you are actually just printing the template through your perl script which will not be parsed by the SSI parser.

However the following would work:

Code:
open NEW, ">/path/to/www/new.shtml" or die $!;
print NEW qq|<!--#include virtual="/foo/bar.html"-->|;
close NEW;

...as you are just printing out the shtml file which will be visited directly as a .shtml.

So in other words, if your script is just generating the .shtml files as in example two above then it will work, however if you are doing something similar to example one, then it won't.
Quote Reply
Re: [Paul] SSI, templates and running perl In reply to
I am confused what to put on the template page. It is just a regular shtml page that has html on it and gets used to make other pages. It is on this page that I want to put the footer.htm SSI. The perl program grabs the template file called home.shtml to make 1000's of other pages and on home.shtml at the bottom is

<!--#include file="footer.htm" -->

which should show the contents of footer.htm on all of the pages that are made with home.html.

Quote Reply
Re: [Aaron Michael] SSI, templates and running perl In reply to
Do you have an example URL?
Quote Reply
Re: [Paul] SSI, templates and running perl In reply to
http://www.jaspergifts.com/...les_main_index.shtml

This is one of the pages that should show the footer.htm at the bottom. When the footer.htm is present it looks like this:

http://www.jaspergifts.com

Scroll to the bottom to see the Sponsers and Other Partners section which is the footer.htm
Quote Reply
Re: [Aaron Michael] SSI, templates and running perl In reply to
Ok I see. One thing I noticed is that your footer is a complete html page so you have:

<html>
<head>
...etc...

...within the middle of your main page.

I don't see a reason as to why the footer isn't loading as both .shtml pages are in the same directory.

Is the ssi include in the main page _exactly_ the same as the one in the broken page?

Last edited by:

Paul: Jan 21, 2003, 9:14 AM
Quote Reply
Re: [Paul] SSI, templates and running perl In reply to
The tag is

<!--#include virtual="footer.htm" -->


This is on home.shtml which is deep in the CGI-bin. I telnet to the the script which I execute and it takes home.shtml and makes the following page:

http://www.jaspergifts.com/...les_main_index.shtml

As you can see the SSI footer does not get put on the static page that the perl script makes.
Quote Reply
Re: [Aaron Michael] SSI, templates and running perl In reply to
A partial breakthrough...If you check out my page in question,

http://www.jaspergifts.com/...les_main_index.shtml


you will see that I have managed to place the footer in two places above the mfg's alphabetical list but when I try to put it below the list, where the footer belongs, it is not incuded?
Quote Reply
Re: [Aaron Michael] SSI, templates and running perl In reply to
It could be the issue I mentioned regarding the html in your footer.
Quote Reply
Re: [Paul] SSI, templates and running perl In reply to
I took out all of what I thought was extraneous like <html> <head>. etc.. on your indication but it still only works above the mfgList?
Quote Reply
Re: [Aaron Michael] SSI, templates and running perl In reply to
Have you looked at the various SSI modules on CPAN to help you embed SSI in Perl scripts?

http://search.cpan.org/...ery=ssi&mode=all

- wil
Quote Reply
Re: [Wil] SSI, templates and running perl In reply to
Thank you. I will take a look!