php-general Digest 8 Oct 2011 15:36:11 -0000 Issue 7510
Topics (messages 315170 through 315170):
Server Side Include translator as PHP functions
315170 by: Complex
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin 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 <---
--- End Message ---