Re: Server Side Include translator as PHP functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 8, 2011 at 1:09 PM, Tommy Pham <tommyhp2@xxxxxxxxx> wrote:

> 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?
>
> Regards,
> Tommy
>

Tommy,
Last question first: yes, using SSI limits the full potential of the
PHP being used, but the point of this exercise is to continue using
the existing SSI includes for this small subsection of the larger
website, and to not recode the larger whole to benefit the smaller
piece. Make whatever Star Trekism of that  you will; we simply don't
have time or resources to use PHP everywhere as we should.

I do not understand your question about criteria; the only criteria
for these Apache Server Side Includes is the relative (or
relative-to-root) filepath:
   <!--#include virtual="/includes/header-pieces/A.inc" -->
If you mean, which server variables am I accessing with SSI and now
need to access with PHP, I'm primarily concerned with the current
filepath.

"SSI include file B" is, in this case, the contents of an HTML
webpage's HEAD block. The PHP-based CMS can fill the HEAD with some
useful info unique to the current page. If I can achieve the _actual
problem_ of translating the SSI commands into PHP, it would be a
simple matter for me to insert some additional material into the
middle of the original. The only reason I even mention this simple
problem is because it explains why I"m bothering to do this at all. If
all I wanted was to get the unaltered output of the SSI includes, I'd
just continue doing <?php include("/includes/header-pieces/A.inc"); ?>
and be on my way.

All I want to know is if someone has already written a set of
functions to translate some if not all SSI commands into PHP.
     e.g.    <!--#include virtual="/includes/header-pieces/A.inc" -->
  becomes <?php include("/includes/header-pieces/A.inc"); ?>
               <!--#set var="foo" value="bar" --> becomes <?php var
foo = "bar"; ?>
               <!--#if expr="${foo}" -->...<!--#elif expr="${bar}"
-->...<!--#else -->...<!--#endif -->
               <?php if($foo) {...} elseif($bar) {...} else {...} ?>
Otherwise, I have to write those functions myself and, inevitably,
spend time I don't have getting it right. I've searched, but I may
easily have missed or not recognized the functions that I need.


-- 
--> CC <---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux