[Xitami] SSI

Paul Reid xitami@lists.xitami.org
Mon, 17 Dec 2001 12:28:57 -0500


> I don't do PERL, PHP, or other scripting language...to me that would be taking big steps backwards, 

Why? Perl was made for extracting info from databases and formatting it
for text printers (or files or streams). PHP is like Perl embedded in
HTML. 

If it is a matter of not abandoning the EXEs you have already built: use
PHP to build most of the page as HTML and use the PHP function to call
an EXEcutable where you already have a tool. 

Getting back to your concept: in X2.4 there is a test-file TESTSSI.SSI.
You need Perl for the SSI feature to work in X2.4. On my WinNT server,
this line works fine: 

Output of CGI program: 
 <!--#exec cgi="/cgi-bin/testcgi.exe?arguments"--><BR>

On my machine: 
 TESTSSI.SSI is in C:\Webpages
 Testcgi.exe is in C:\Xitami\cgi-bin

Testcgi is an EXE program supplied by Xitami that simply prints some
environment variables as HTML. 

> Your filter idea is really intriguing

So try it. Put a copy of DOS SORT.EXE in \Xitami\cgi-bin. Write a HTML
file that prints several different lines of text, and call it TEST.SRT
and put it in your web folder.  

In defaults.cfg, add a line to tell Xitami what to do with an SRT file
(feed it to SORT): 
   [Filter]
    .SRT=c:\xitami\cgi-bin\sort.exe
    .ssi=c:\xitami\perlssi

In a browser, open localhost\TEST.SRT. Xitami should feed the file to
SORT and send it to your browser. The output will be a Mess, because
your browser will be baffled by out-of-order HTML tags and will probably
re-wrap lines. But you should see that your multi-line text comes back
alphabetized by the first character on each line.

If you like making EXEs.... write one that reads Standard In, replaces
all occurrences of "Large" with "Colossal!!!", and writes to Standard
Out. Write a HTML file with the word "Large" in it, save it in your web
folder with a unique file extension. Set Xitami's filter configuration
to feed that extension to your EXE in cgi-bin. Open that file through
the server and see that all your "Large" products are now "Colossal!!!" 

The next step, replacing some unique string or tag with data from
elsewhere, is left as an exercise.  

> Win32 executables.  This offers tremendous power for me, but making
small changes to an otherwise static page can be a big job.  

That's a good summary. However Perl/PHP come with functions directly
aimed at database reporting and text formatting, are typically far
easier to change than an EXE, and can call an EXE if that is the best
way to do it. 

 -PRR