Included files can have other extensions for example,. In SSI, the process of including takes two separate files and creates one whole file. The server takes the SSI page and inserts it into the page calling it.
If the SSI calls a file that is located in another directory in the account, use include virtual instead of include file. For example, you might want to print a message at the bottom or the top of your page indicating when it was last modified.
To get the system to do this, you need to include a directive specifying that action. Such a directive is in the form of a " Server-Side Include " command. This document explains how to use some of these commands. You can determine the current version by logging in to Hercules and using " apachectl -v ". U of R Home. Computer Science. The file you include can be either plain text or text with HTML code. Naming your includes with.
The file you include can also contain further includes itself , which will be evaluated before it is sent to be included in the calling document.
These includes will need to be. You should be careful with this ability however, as excessive recursive including in a single file will slow your server down. You can even include CGI scripts:.
Thanks to our wonderful supporters! Having fun? Getting lost? The virtual attribute is probably more useful, and should specify a URL relative to the document being served. SSI directives can be contained in the included file, and includes can be nested - that is, the included file can include another file, and so on.
In addition to being able to config the time format, you can also config two other things. If you want to change that message to something else, you can do so with the errmsg attribute to the config function:. Hopefully, end users will never see this message, because you will have resolved all the problems with your SSI directives before your site goes live.
And you can config the format in which file sizes are returned with the sizefmt attribute. You can specify bytes for a full count in bytes, or abbrev for an abbreviated number in Kb or Mb, as appropriate. Here's something else that you can do with the exec function.
The following, for example, will give you a directory listing. Note that this feature is exceedingly dangerous, as it will execute whatever code happens to be embedded in the exec tag. In addition to spitting out content, Apache SSI gives you the option of setting variables, and using those variables in comparisons and conditionals.
Using the set directive, you can set variables for later use. We'll need this later in the discussion, so we'll talk about it here. The syntax of this is as follows:. To put a literal dollar sign into the value of your variable, you need to escape the dollar sign with a backslash.
Finally, if you want to put a variable in the midst of a longer string, and there's a chance that the name of the variable will run up against some other characters, and thus be confused with those characters, you can place the name of the variable in braces, to remove this confusion.
It's hard to come up with a really good example of this, but hopefully you'll get the point. Now that we have variables, and are able to set and compare their values, we can use them to express conditionals. This lets SSI be a tiny programming language of sorts. This allows you to effectively generate multiple logical pages out of one actual page.
0コメント