[wp-trac] [WordPress Trac] #12935: Evolve the URL routing system
WordPress Trac
wp-trac at lists.automattic.com
Thu May 27 22:00:53 UTC 2010
#12935: Evolve the URL routing system
--------------------------+-------------------------------------------------
Reporter: mikeschinkel | Owner: ryan
Type: enhancement | Status: new
Priority: normal | Milestone: 3.1
Component: Permalinks | Version: 3.0
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
Comment(by jacobsantos):
Replying to [comment:28 mikeschinkel]:
> I am aware of your advocacy of an MVC approach similar to Django and
what I assume CakePHP, CodeIgnitor and Rails use but I think that would so
significantly change that it is not viable, at least not in one
revolutionary step. The approach I'm taking it is maintain the concept
for mapping URLs to query vars and letting query vars drive the loading of
content.
Not really, the systems like that take a directory controller approach,
where you have a single class within a directory. I don't believe
WordPress would ever adopt that system, nor do I fully believe that is the
best way to do it. Easier yes, but applicable to every system? Probably
not.
What I envision for WordPress is more like Zend Framework and what I kind
of assumed you were going to implement. Really, I mean the Routes and URI
segment code is similar enough that most libraries probably duplicate a
lot of the same code. Where the differences are in the way the controller
is loaded and executed.
I'm thinking it might look similar to:
{{{
<?php
wp_register_controller($route, $callback);
?>
}}}
This might look up the route and add the callback or register the route
with the callback.
I do think we are looking at two different problems. My problem is that I
know the controller implementation is difficult and needs a lot of work.
Your problem is that the routes themselves need a better implementation.
Our goals are not conflicting. My goals can be accomplished on top of your
implementation and I believe I will most likely focus on supporting both
the current system and yours when you develop it.
>
> Yes, I agree that specifying the callback as part of the Routes might be
preferable if we didn't have existing themes and plugins that expect the
query system to work as is but I think this is the best approach
considering where we are right now. Of course I'd love to hear from others
on this issue like Andrew Nacin, scribu, hakre, Johnonolan etc. to see
their opinion.
I think many implementations piggy back onto the Routes implementation for
loading the controller. That doesn't need to be the case in this. They
could be kept separate and made to just basically the controller checks
the route and then loads the correct callback. This could be done now, it
is just easier when the routes is created for that specific purpose
instead of the way it is now with WordPress routes the main focus and
extra routes something that is just tacked on as supported, but not quite
fully.
> '''One point of note'''; the innovation over this approach compared to
the existing rewrite system is that '''it inspects path segments instead
of full paths'''.
This will work much like the others, which will lead it towards a
controller implementation that makes sense to those who work with the
others.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12935#comment:31>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list