Well, that may sound a little crazy, but the bear is here with me for a moment.
I am working on a site where the standard is to use SSI to include page headers, footers and menus. Included files use SSI conventions to handle different browsers, some #include attachments, and some # set / # if tricks to highlight the current page in the menu. In other words, this is more than just #include directives in SSI.
I'm sure some might argue with aesthetics, but actually it works very well for static HTML.
Now the problem is: I would just “include” the same SSI header and footer files from my PHP scripts, while avoiding code duplication and maintaining a consistent look and feel. If PHP runs in a regular mod_php environment, I would be able to do this using the PHP virtual () function. Unfortunately, the site uses FastCGI / suexec to run PHP (so that each VirtualHost can work as a different user), and this violates virtual ().
I use a fairly simple SSI parser that I wrote in PHP (it processes #includes and some really simple #if instructions), but I would like to get a more general solution. So, before I go crazy and write some probably buggy, more complete SSI parser, does anyone know about a full SSI parser written in PHP? Naturally, I am also open to other solutions that work under the limitations that I have outlined.
Thanks so much for your time.
php apache ssi
Rick koshi
source share