NYCPHP Meetup

NYPHP.org

[nycphp-talk] Many pages: one script

Hans Zaunere lists at zaunere.com
Mon Aug 6 07:55:59 EDT 2007


Jon Baer wrote on Sunday, August 05, 2007 9:19 PM:
> 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.control
ler.router.usage


I think there is a distinction to make here, however.

There are two parts to the URL
routing/handling/SEO-friendly-URL-of-the-month/etc game:

1: getting the web server to relax it's by-default strict mapping of the URL
space to the filesystem, and then passing whatever the request was down to
the processing language

2: programming mechanisms in the processing language to intelligently deal
with whatever URL it gets from the web server

In PHP at least, these are two different things.  At some point there was
interest in apache_hooks, but it unfortunately never matured.

In other technologies, #1 equates more to the processing language reaching
up and grabbing what it needs from the server, and then taking over.  In
PHP, however, it's certainly a "top-down" approach.

For #1, most frameworks, and the two mentioned above, prefer the use
mod_rewrite.  Then they each have their own mechanism to handle #2, with
some arguably being worse than others.

There's also fundamental differences in the way #1 can be handled.
Rewriting is a very different thing than aliasing a handler or set of URLs
to a single URL or processor.

The later is more elegant - and more flexible - avoiding mucking with obtuse
rewrite conditions and rules that require a testing cycle and often depend
on a fixed set of extensions to ignore.

---
Hans Zaunere / President / New York PHP
    www.nyphp.org  /  www.nyphp.com





More information about the talk mailing list