in reply to SSI Not being processed

"So you want to include SSI directives in the output from your CGI script, but can't figure out how to do it? The short answer is "you can't." This is potentially a security liability and, more importantly, it can not be cleanly implemented under the current server API. The best workaround is for your script itself to do what the SSIs would be doing. After all, it's generating the rest of the content."

-- Apache FAQ

In other words, you have two choices:-

  1. Build static HTML pages (with the SSI calls in) instead
  2. Pull the content into your existing script and print it along with your other HTML

__________
"Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to one instruction which doesn't work." -- (Author Unknown)

Replies are listed 'Best First'.
Re: Re: SSI Not being processed
by Gerard (Pilgrim) on Jan 24, 2003 at 01:11 UTC
    I feared as much. The problem being that, (thankfully) I am leaving this position shortly, but am unlikely to be replaced with someone that knows anything about perl, and there is no one else in this small company that does know any perl now.

    I would much rather leave things as simple as possible for the not so technically minded. i.e. editing the file to be included shouldn't be too much of a problem for them, but editing the perl script would be.

    I think that I would be best off to open the files to be included in the script read in the entire contents and print it back out in the same place as they would be if they were using the ssi.
    Just wanted to check that there was no other SSI way to do this.

    Thanks, Gerard.

      Well, neither of the solutions I gave need be that complex.

      To do the first, your existing script would only need to be modified to print to a file instead of the screen/browser.

      The second solution, again using your existing script, wouldn't require the script to be edited more than once. It would just read from the include files and print them - they wouldn't need to be physically inside the code. The technically challenged would just edit the included file, and leave the Perl alone.

      I risk being hung, drawn and quartered for even suggesting this, but is using PHP an option? (That has SSI type functions built in).

      __________
      "Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to one instruction which doesn't work." -- (Author Unknown)