On Sat, Oct 8, 2011 at 8:36 AM, Complex <complex.confus...@gmail.com> wrote:

> 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 <---
I think you didn't provide enough details to get a more accurate suggestion
of a solution, but here goes...  Is 'include SSI file B' always included and
always need to be replaced?  If so, that's a very apparent solution.  If
not, what are criterias?  URL? Query parameter(s) and/or value(s)?  Certain
user(s)?  Certain group(s) of users?  Certain hour of the day?  Certain user
agent(s)? etc...  Regardless of how dynamic any site is, there's a always
some kind of pattern.  What you need to do is identify that pattern and do
what you need accordingly.  What about having PHP read those files to be
included and output without having to rely on SSI mechanisms?

I'm just curious... since PHP is OOP and, IIRC of SSI, the use of SSI limits
the full potential of OOP and PHP.  Is the control of the application and
configurations beyond yours?


Reply via email to