Re: [PHP] can I sandwich html docs with PHP

2002-03-01 Thread Michael Kimsal

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://wwwmydomaincom/joehtml
 
 My module can take joehtml and insert it as the body of a 
 template and then return that to your browser or if you request 
 something else like 
 
 http://wwwmydomaincom/image_of_joegif
 
 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://1615823066/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)
 
 Peter
 


I 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://wwwphphelpdeskcom
Taking the ? out of ?php
734-480-9961


-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] can I sandwich html docs with PHP

2002-03-01 Thread Rasmus Lerdorf

  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://wwwmydomaincom/joehtml
 
  My module can take joehtml and insert it as the body of a
  template and then return that to your browser or if you request
  something else like
 
  http://wwwmydomaincom/image_of_joegif
 
  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,

Yes, I started this work and was hoping there would be more interest out
there  If you look at the apache_hooks CVS branch you will see the code
needed to register a PHP script to handle the url translation request
stage  Each of the other stages would be implemented the same way

-Rasmus


-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] can I sandwich html docs with PHP

2002-02-11 Thread Michael Sims

At 04:46 PM 2/11/2002 -0600, Peter J. Schoenster wrote:
How can I do this with PHP?

I want the urls to be like:

http:://www.mydomain.com/page.html
http:://www.mydomain.com/page2.html
http:://www.mydomain.com/page3.html

etc. One motive is to be sure that no search engines are
discouraged from indexing my site plus I'm going to create pages
and nav snippets with links to all those pages.

I'm not sure I really know what you're asking, but if you are asking if you 
can use PHP code within HTML files (with *.html extensions) then the answer 
is yes.  If you're running Apache, add the following to your httpd.conf:

AddType application/x-httpd-php .html

This will make the web server send *.html files to the PHP parser as 
well.  This way you don't have to have your scripts end with *.php.  The 
drawback is that every single *.html file will be sent to the PHP engine 
for parsing, even if it doesn't contain any code, so your web server will 
have that extra overhead to deal with.  If you have a large site that gets 
a great many hits a day you may not want to do this for performance reasons...

Please disregard if this is not what you were asking... :)


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




Re: [PHP] can I sandwich html docs with PHP

2002-02-11 Thread Peter J. Schoenster

On 11 Feb 2002, at 19:30, Michael Sims wrote:

 I'm not sure I really know what you're asking, but if you are asking
 if you can use PHP code within HTML files (with *.html extensions)
 then the answer is yes.  If you're running Apache, add the following
 to your httpd.conf:

 Please disregard if this is not what you were asking... :)

No, thanks. It tells me I wasn't clear.

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.

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).

Peter



---
Reality is that which, when you stop believing in it, doesn't go
away.
-- Philip K. Dick

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