E McCrory
E McCrory

Reputation: 11

Replacement for PHP's virtual function?

The web team here has created a nice system of Server-Side Includes (SSI) and HTML files that give all of our web sites the same branding.

E.g., our public-facing HTML web pages start like this (strictly, this is an SHTML snippet):

<!--#set var="META_TITLE" value="My Web Site Title" -->
<!--#set var="PAGE_HEADER" value="My web site header text"-->

<!--#include virtual="/companyincludes/hub-page-top.html"-->
<!--#include virtual="/localincludes/header-image.html"-->
<!--#include virtual="/companyincludes/hub-page-top-mid.html"-->
<!--#include virtual="/localincludes/nav-left.html"-->
<!--#include virtual="/companyincludes/top-close.html"-->

Note the SSI directives "#set var" and "#include virtual". (There are also SSI directives like this in the "companyinclude" files.)

Let's call this collection of characters top.html.

Thus, our public-facing PHP web pages start like this:

<?php
virtual("top.html");
// ...

Note that the PHP function include() (and require() and the _once() variations) will not interpret the SSI directives in the HTML text, as shown above. The function virtual() does this trick.

I have been told by our Apache admin team, "when we upgrade our servers to RHEL 7, we will be switching over to PHP-FPM, so the virtual command will stop working."

Is there another way to have PHP include HTML files that are parsed for SSI directives?

(The alternative we are pursuing is to re-write these include files in PHP.)

Upvotes: 1

Views: 302

Answers (0)

Related Questions