Re: can I sandwich html docs with PHP
| From: | Michael Kimsal | Date: | Sat, 02 Mar 2002 01:02:39 +0000 |
| Subject: | Re: can I sandwich html docs with PHP | ||
| References: | 1 2 | Groups: | php.general php.general |
| Request: | Send a blank email to php-general+get-86871@lists.php.net to get a copy of this message | ||
Peter J. Schoenster wrote:
Using mod_perl I can write a module for any phase that Apache goes through while handling a request. Based upon any variables I want, I can tell Apache to have my module handle one of those phases. So when you request this url for example: http://www.mydomain.com/joe.html My module can take joe.html and insert it as the body of a template and then return that to your browser or if you request something else like http://www.mydomain.com/image_of_joe.gif then my module just declines to handle that and apache continues through it's phases.No, mod_php can't do that - at least not at this current stage. I *thought* I'd heard some rumblings of some of the PHP team looking to address the issue of allowing PHP more access to the Apache request cycle. I think there's 7 stages, and PHP is only hooked in to one stage, IIRC. Maybe it was Rasmus in a recent interview who suggested there might be tighter integration with Apache, I don't know. Perhaps this is also something for Apache 2, down the road,
Here is an example (bad execution of an example though) http://161.58.230.66/images/ I have the following .htaccess file in that directory: SetHandler perl-script PerlHandler Apache::Schoenster_Gallery PerlSetVar DOCROOT /usr/local/etc/httpd/htdocs/images PerlSetVar URL_PATH /images I can stick this .htaccess file in any directory (only makes sense where I have images) and it uses those 2 variables above to determine where to read for images and where to write the files which produces the frame-set that you see (the module looks in that file for templates to parse so I can have different looks in different places wihout changing the module). I say it's a bad execution because I'm using imagemagick to resize (regardless of original size). If I add new images it will automatically create a thumbnail (which can currently be larger than the original :) of that. I use a db file to cache thumbnails already created but it does check file modification date to see if it should resize the image or not. But what I want to do is to do this with html files where I'll have a few templates (header,footer,navigation,boxes) that will be created on the fly depending upon variables when a client requests an html file and I want to know if I can do this in PHP without rewriting the url (which is not such a bad option perhaps). PeterI think you'll have to use url rewriting for this. Not as tight integration as mod_perl, but if you have to use it, that's probably your only option at this point. Good luck! Michael Kimsal http://www.phphelpdesk.com Taking the ? out of <?php 734-480-9961