Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Server Side Includes
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Control directives === Control directives are later added to SSI. They include the ubiquitous if-elif-else-endif flow control and variable writing as well as more exotic features like loops only found in some implementations. {| class="wikitable" |- ! Directive ! Parameters ! Description ! Example ! Found in |- | {{plainlist| * if * elif * else * endif }} | expr | The [[if statement]]. Used for condition tests that may determine and generate multiple logical pages from one single physical page. <code>elif</code> is a shorthand for nested else-if. <code>else</code> and <code>endif</code> do not accept parameters. Expression syntax vary among implementations. Variable existence and equality/regex checks are commonly supported. Jigsaw uses expressions split over multiple attributes instead.<ref name=jig/> | <pre style="white-space:pre"><nowiki> <!--#if expr="${Sec_Nav}" --> <!--#include virtual="secondary_nav.txt" --> <!--#elif expr="${Pri_Nav}" --> <!--#include virtual="primary_nav.txt" --> <!--#else --> <!--#include virtual="article.txt" --> <!--#endif --> </nowiki></pre> | Ubiquitous. |- | set | var, value | Sets the value of a SSI variable. Apache provides additional parameters for [[encoding]]s.<ref name=apache-inc/> | <pre style="white-space:pre"><nowiki><!--#set var="foo" value="bar" --></nowiki></pre> | Apache,<ref name=apache-inc>{{cite web |title=mod_include |url=https://httpd.apache.org/docs/current/mod/mod_include.html |website=Apache HTTP Server |access-date=25 March 2019}}</ref> Nginx<ref name="nginx">{{cite web |title=ngx_http_ssi_module |url=https://nginx.org/en/docs/http/ngx_http_ssi_module.html |website=nginx.org |access-date=25 March 2019}}</ref> |- | <code>printenv</code> | | This directive outputs a list of all SSI variables and their values, including environmental and user-defined variables. It has no attributes. | <pre style="white-space:pre"><nowiki><!--#printenv --></nowiki></pre> | Apache<ref name=apache-inc/> |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)