| How to have an #include call another #include! Can't believe I didn't think of this sooner |
MichaelBluejay

msg:4157362 | 4:53 am on Jun 23, 2010 (gmt 0) | I use the .ssi extension for my includes, to differentiate the files on my server from pages. Early on I learned that my included file couldn't call another include. For example, if the "sidebar.ssi" code was: The lamb lies down on Broadway. <!--#include virtual="secondInclude.ssi"--> |
| then my page would show "The lamb..." sentence, but it would end there. It wouldn't pull in the secondInclude. For years I thought that was a limitation of SSI, but it's not. The reason the second .ssi wasn't included is that the server didn't know to look for it, because I never told it to scan .ssi files for includes! All I had to do was add that to my .htaccess file: | AddHandler server-parsed .html .ssi |
| And Ta-Da! Now includes can call other includes. I hope this helps somebody. By the way, when searching around about SSI extensions, I found this article on SSI extensions for refugees [nilc.org], which wasn't exactly what I was looking for.
|
SEO_Shruti

msg:4181705 | 10:02 am on Aug 4, 2010 (gmt 0) | You can also use it in other way. For that the same condition applies that ssi is enabled. You can include a html file in another file. Suppose, you want to include matter of file B.html in A.html include the code <!--#include file="b.html" --> where you want to place that content and save a.html to a.shtml
|
|
|