Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (45 sloc) 2.21 KB
== link:index.html[Index] -> link:modules.html[Modules] -> link:modules_handlers.html[Handlers]
Handler: Server Side Includes
Server Side Includes, also known as SSI, are directives placed in HTML
pages meant to be evaluated on the web server while the requests are
being delivered. The intended use is adding some dynamic content to
existing HTML pages without having to serve the whole content
dynamically (be it through CGI, SCGI, FastCGI, etc.).
SSI are very useful to add small pieces of information, but are not
the way to go if the majority of the content has to be generated at
the time it is served. Traditionally the web server was notified that
it should apply SSI when it processed files ending with the `.shtml`
Although this will be the majority of cases where this can be of
usefulness, Cherokee is not limited to just one file extension. The
SSI handler applies to whatever is matched by the rule where it has
been configured.
Currently Cherokee supports the following SSI directives:
* _include_: this tag inserts the contents of a file. Both `virtual`
and `file` includes can be performed. The former uses paths
beginning at the Document Root, and the latter uses paths relative
to the current directory.
* _fsize_: inserts the size of a given file.
* _flastmod_: inserts the last modification date of a given file.
In any of the above cases, the specified data is inserted into the
HTML page at the location of the token.
A typical use would be using and include file for header and footer,
allowing for an easy and fast way of updating the whole theme of a
website. Only one header and footer file would have to be created, and
that could be inserted through SSI in the rest of the pages with SSI
directives like the following ones:
<!--#include virtual="/header.html" -->
<!--#include virtual="/footer.html" -->
Note that the include element can determine what file to include based
on the `virtual` or `file` attributes, which have the behavior
specified above. In any case, despite specifying absolute or relative
paths containing `..`, the SSI handler will not include any files
outside the webserver document root.