Server Side Include translator as PHP functions

From: Date: Sat, 08 Oct 2011 15:36:00 +0000
Subject: Server Side Include translator as PHP functions
Groups: php.general 
Request: Send a blank email to php-general+get-315170@lists.php.net to get a copy of this message
Hello, Can you please tell me if there's already a set of PHP functions for translating SSI commands to PHP? I'm looking to do two things -- one difficult, one easy -- using PHP on a hosted server. My client has web pages that use Server Side Includes, and one sub-site that uses PHP. The task is to make the PHP sub-site use the same SSI includes as the rest of the site to maintain a consistent code structure. I can simply use include_once() to include each SSI include; that works fine. However, I'd like to recognize and replace one of the SSI instructions with a more nuanced PHP instruction that will insert dynamic information from the sub-site's environment. 1. include SSI files A 2. include SSI file B, Recognize B and replace it with some PHP code 3. include SSI file C and i can't actually do that b/c PHP gets run first and then SSI instructions. So the difficult thing I want to do is to read the SSI files (literally, using fread or similar), translate them to PHP ('include virtual' --> include(), set var="foo" value="bar" --> var foo = bar, etc), and then execute them. Then the simple thing I want to do will be recognizing the commands I want to replace or modify and doing so. Since this is a hosted solution, I don't believe I can install any PHP modules, and I'll have to use some functions instead. Does that already exist, please? -- --> CC <---

« previous php.general (#315170) next »