SSI Directives question

Status
Not open for further replies.

coversx

New Member
Messages
15
Reaction score
0
Points
0
Hello,

I am trying to run an SSI directive such as <!--#flastmod file=""--> in a .shtml document that is referencing an include file via <!--#include virtual=""--> but it does not work, i.e. it simply renders the #flastmod command.

Any help here would be greatly appreciated.

Thank you for reading.
 

hbazer

Member
Messages
398
Reaction score
7
Points
18
I use this SSI test file on server [ Vox ] which has a test of [ #include virtual ] - works for me

This is the source...
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">

    <title>
      Hello World using SSI
    </title>
  </head>
<body>

<h1>Hello World using SSI</h1>

Test #echo var="LAST_MODIFIED"<br>
This file last updated: <!--#echo var="LAST_MODIFIED" -->

<BR><BR>

Note: File [ yellow_submarine.html ] in sub-folder [ ocean ] is one line "&lt;p&gt;We see little fishes in the sea&lt;/p&gt;"<BR>
Test #include virtual="/ocean/yellow_submarine.html"<br>

What do you see ? <!--#include virtual="/ocean/yellow_submarine.html" -->

Set 'time' format: #config timefmt="%A %B %e %Y %H:%M:%S %Z"<br><br>
<!--#config timefmt="%A %B %e %Y %H:%M:%S %Z" -->

Test #echo var="DATE_LOCAL"<br>
Server local date: <!--#echo var="DATE_LOCAL" -->
<BR>
GMT Date: <!--#echo var="DATE_GMT" -->

<BR><BR>

Test #echo var="LAST_MODIFIED"<br>
file yellow_submarine.html last updated: <!--#echo var="LAST_MODIFIED" -->

<BR><BR>

Test #flastmod file="$DOCUMENT_NAME"<br>
file yellow_submarine.html last updated: <!--#flastmod file="$DOCUMENT_NAME" -->

<BR><BR>

Test #echo var="DOCUMENT_NAME"<br>
DOCUMENT_NAME is: <!--#echo var="DOCUMENT_NAME" -->

<BR><br>

Test #fsize file="$DOCUMENT_NAME"<br>
Size of file $DOCUMENT_NAME ==> <!--#fsize file="$DOCUMENT_NAME" -->
<br>Note: This is the size of the file [ yellow_submarine.html ]

</body>
</html>

This the output...
Hello World using SSI

Test #echo var="LAST_MODIFIED"
This file last updated: Sunday, 05-May-2013 09:11:47 CDT

Note: File [ yellow_submarine.html ] in sub-folder [ ocean ] is one line "<p>We see little fishes in the sea</p>"
Test #include virtual="/ocean/yellow_submarine.html"
What do you see ?

We see little fishes in the sea

Set 'time' format: #config timefmt="%A %B %e %Y %H:%M:%S %Z"

Test #echo var="DATE_LOCAL"
Server local date: Sunday May 5 2013 09:26:04 CDT
GMT Date: Sunday May 5 2013 14:26:04 GMT

Test #echo var="LAST_MODIFIED"
file yellow_submarine.html last updated: Sunday May 5 2013 08:56:29 CDT

Test #flastmod file="$DOCUMENT_NAME"
file yellow_submarine.html last updated: Sunday May 5 2013 08:56:29 CDT

Test #echo var="DOCUMENT_NAME"
DOCUMENT_NAME is: yellow_submarine.html

Test #fsize file="$DOCUMENT_NAME"
Size of file $DOCUMENT_NAME ==> 38
Note: This is the size of the file [ yellow_submarine.html ]
 

coversx

New Member
Messages
15
Reaction score
0
Points
0
Hi,

I managed to get them going by ensuring that any include file is parsed by the server as well.

I don't know what kind of performance hit is induced by making my html files server parsed but my includes now have the .shtml extension and I have a very small .htaccess file in the directory of the originating page.

Cheers
 

hbazer

Member
Messages
398
Reaction score
7
Points
18
The [ XBitHack ] directive can be used to parse normal (text/html) files, based on file permissions (Perms)

If you're not willing to put up with the performance costs of the "directory method" for enabling parsing of non-.shtml pages (that method tell the server to parse all files) - use [ XBitHack ] as a "file method" you then - can specify on a file-by-file basis which non-.shtml files (they do not have a .shtml extension) - and those with a .shtml extension get parsed.

If your .htaccess file contains the [ AddType ] and [ AddHandler ] statements for the "directory method" REMOVE THEM.

Add this line to you .htaccess file...
XBitHack on

Only the files, that you want parsed (those that will contain SSI directives) - set the [ permissions ] to 744 (instead of 644). This is what tells the server to parse the file with the "file method"

IMO what makes this a better way - 1. you do not need to rename files (you already use) with a extension of [ .HTML ] to [ .SHTML ] and redo the links - 2. the users do not need to add that 'S' - 3. you reduce the server load
 
Status
Not open for further replies.
Top