NYCPHP Meetup

NYPHP.org

[nycphp-talk] Many pages: one script

Jon Baer jonbaer at jonbaer.com
Sun Aug 5 21:18:32 EDT 2007


I have to say that after spending a long time w/ Dynamo / Tomcat /  
Struts and mod_rewrite that eventually I got down to learning the  
routing mechanism of frameworks (MVC) and find it to be extremely  
flexible and very well thought out + could easily replicate a servlet  
URI request setup.

http://manual.cakephp.org/chapter/configuration
http://framework.zend.com/manual/en/ 
zend.controller.router.html#zend.controller.router.usage

- Jon

On Aug 5, 2007, at 1:42 PM, Elliotte Harold wrote:

> I'm considering a simple site that I may design in PHP. PHP is  
> probably the simplest solution except for one thing: it carries a  
> very strong coupling between pages and scripts. As far as I've ever  
> been able to tell PHP really, really, really wants there to be a  
> single primary .php file for each URL that does not contain a query  
> string (though that file may of course invoke others).
>
> For the system I'm designing that simply won't work. In Java  
> servlet environments it's relatively trivial to map one servlet to  
> an entire directory structure, so that it handles all requests for  
> all pages within that hierarchy.
>
> Is there any *reasonable* way to do this in PHP? The only way I've  
> ever seen is what WordPress does: use mod_rewrite to redirect all  
> requests within the hierarchy to a custom dispatcher script that  
> converts actual hierarchy components into query string variables. I  
> am impressed by this hack, but it's way too kludgy for me to be  
> comfortable with. For one thing, I don't want to depend on  
> mod_rewrite if I don't have to.
>
> Surely by now there's a better way? How do I overcome the one file  
> per URL assumption that PHP makes?
>
> -- 
> Elliotte Rusty Harold  elharo at metalab.unc.edu
> Java I/O 2nd Edition Just Published!
> http://www.cafeaulait.org/books/javaio2/
> http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/ 
> cafeaulaitA/
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070805/268503e5/attachment.html>


More information about the talk mailing list