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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [RedRum] Replace Text in HTML Template: Edit Log

Administrator / Moderator

Aug 14, 2002, 2:58 PM

Views: 8349
Re: [RedRum] Replace Text in HTML Template

If the point was whether <!--#include file="/blah.txt"--> can be used in a cgi script, then yes, I've completely missed the point.

If the point was having files included into a cgi file, using date formats and echoing some variables, then I don't believe I missed the point. It's the big picture I'm concerned with, not necessarily the technical details.

True, SSI won't work in scripts, but the problem at hand was running SSI commands. It's pedantic to not consider readily available alternatives which will yield the same result. Whether or not it fakes SSI or really is SSI isn't the issue. The issue is what needs to be done, not how it is done.

The short, easy and technically correct answer is no, you can't use <!--#include file="/blah.txt"--> -- SSI doesn't work in cgi scripts, period -- (no alternatives offered). This doesn't help to solve the problem.

The longer and more helpful answer is no, you can't use <!--#include file="/blah.txt"-->, but you can use [ davorg ]'s suggestion earlier in this thread or a module that'll fake it and still do what needs to be done without having to duplicate the contents of your included files or write other code to emulate your SSI calls.

He needed this to be done:

<!--#include file="topbar.txt" -->  
<!--#include file="sidebar.txt" -->
<!--#include file="bottomnav.txt" -->
<!--#config timefmt="%Y" --><!--#echo var="DATE_LOCAL"-->

This can be done from within his program with:

use CGI::SSI;  

print $ssi->include(file=> 'topbar.txt') .
$ssi->include(file=> 'sidebar.txt') .
$ssi->include(file=> 'bottomnav.txt') .
'@' .
$ssi->config('timefmt', '%Y') .

It may be a workaround that mimics SSI, but it sure looks like a solution.

Update: Fixed typo.

(This post was edited by Jasmine on Aug 14, 2002, 5:08 PM)

Edit Log:
Post edited by Jasmine (Administrator) on Aug 14, 2002, 5:08 PM

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

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