Including static content in a page
|
|
Code
|
<!--#include file="boilerplate.inc"-->
|
|
Result
|
Four score and seven years ago, our fathers brought forth on this continent...
|
|
|
Code
|
<!--#include virtual="/doran/ssi/boilerplate.inc"-->
|
|
Result
|
Four score and seven years ago, our fathers brought forth on this continent...
|
|
|
|
Code
|
<!--#echo var="DATE_LOCAL"-->
|
|
Result
|
Sunday, 22-Nov-2009 15:37:12 CST
(A different date format can be specified.)
|
Showing file size
|
|
Code
|
file is <!--#fsize file="big-file.tar.gz"--> in size
|
|
Result
|
file is 71K in size
|
Executing a server command
|
|
Code
|
<!--#exec cmd="/opt/sfw/bin/gdate '+%B %e, %Y'"-->
(Use an absolute path to operating system command.)
|
|
Result
|
November 22, 2009
|
Executing a CGI program
|
|
Code
|
<!--#exec cgi="rotate-robot.cgi"-->
(In this example, refreshing the page randomly picks a robot to display.)
|
|
Result
|
 "Crush, kill, destroy." - Red Robot
|
Server Side Include error messages (when things go wrong)
|
|
Code
|
<!--#include virtual="./missing-file.inc"-->
(In this example, we are trying to include a non-existent file.)
|
|
Result
|
[an error occurred while processing this directive]
|
|
Code
|
<!--#config errmsg="[d'oh!]"-->
(Here is how you would personalize the error message.)
|
|
Result
|
[d'oh!]
|