Proposal: Pre-processing some PHP tags but not others

From: Date: Thu, 17 Feb 2000 08:39:17 +0000
Subject: Proposal: Pre-processing some PHP tags but not others
Groups: php.dev 
Request: Send a blank email to php-dev+get-15629@lists.php.net to get a copy of this message
[The Problem] Hi there! I have run into a problem which I believe is encountered by many web sites which have database derived pages containing both infrequently changing and frequently changing/user specific data. I am interested in pre-processing some PHP tags (template tags and infrequently changing information derived from a database) while leaving other PHP tags unprocessed (user queries or frequently updated data). Basically, I need to run an internal web server from which a program (wget) will "render" the site. A public web server will then serve up the processed version of the site. I want to pre-process the templates and infrequently changed database derived information while still leaving some PHP tags unprocessed. These would then be processed by the public web server. [Sub-optimal Solution] Is there a general way to do this? It seems easy enough if you have short open tags, <? ?>, disabled on the first web server but enabled on the public web server. In that case, everything for which processing should be delayed is enclosed in short tags. These are passed unprocessed through the first server, but are processed on the public server. However, this does not seem like an optimal solution because you cannot use XML when short tags are enabled. [Proposal] Would it be possible to add a new open tag to PHP that provides for delayed processing of the code bounded by that start/end tag? Something like <?php-postpone-N ?> or <?php-delay-N ?> would be very helpful. Here, "N" is in integer specifying for how many stages processing should be delayed. Under this scheme, when the PHP parser serves a page with such a tag, <?php-postpone-1 ?> would be rewritten as <?php ?> while <?php-postpone-2 ?> would be rewritten as <?php-postpone-1 ?> (I do not know why someone would want to delay processing for multiple passes through the parser, but as long as we are entertaining the idea of delayed processing, it might as well be general). If this delayed processing mechanism is added, it would also be nice to have compile time and php3.ini options causing all the postponed tags to be processed on the first pass through the parser. Disabling the delayed processing scheme would be very convenient during site development. [Request for Feedback] What do the PHP developers think about this? Is this implementation a good solution, or is there a better way to accomplish this goal? I think that it would be helpful to a number of sites which do not want to bog down their servers with unnecessary queries while still preserving the ability to embed other PHP code in the same page. Thanks! Benjy Thomas

« previous php.dev (#15629) next »