[wp-hackers] Options for Controller - Views

Jacob Santos wordpress at santosj.name
Fri Nov 20 03:06:27 UTC 2009


Using template_redirect is a dirty hack and I can get by not using 
add_rewrite_rule function completely with a few other hacks. The point 
of MVC is to easily extend the base with a defined flow path. Right now 
it is like a maze with many paths leading to dead ends. If I can get by 
with rewriting the controller and view handling to prevent having to 
hack it together like it is now, I could use it to cleanly create 
something with the WordPress API.

In fact, I could do without the whole "blog" portion and use the Plugin 
API and other parts, like the administration to create something 
completely different using WordPress as the base. As it stands now, it 
would require a great deal of hacking and I could never really remove 
the portions of WordPress that makes WordPress, well WordPress. If that 
is the case, then I'm better off starting from a framework that actually 
implements MVC properly and without all of the WTF?s that exist within 
WordPress.

I'll rather not have to create a hack. The function is a good one and 
could be used. I think it would be better to extend it to call a hook or 
a class which will create the view. If you can easily redirect the flow 
to your function, method or class without relying on init hook, then you 
can unhook the current blog pages or whatever.

Also, it has to be easy, so if someone wants to extend what I created, 
they can do so without having to kick their own ass trying to figure it 
out. Do you know how long it takes to learn Zend Framework, Code 
Igniter, etc? An hour and it is pretty straight forward with all of the 
examples and that is also with working development. I spent 4 hours 
trying to use WP_Rewrite and after feeling like an idiot and cursing the 
name of the person who created such a monstrosity, I gave up and used 
the template_redirect route. To find that I have to use it anyway isn't 
all that appealing.

Usually, I try not to compound a dirty hack with more dirty hacks. You 
should be able to do this with two functions, the one you call to call 
your function and your function that is run. The mod_rewrite creator 
code can be broken into its own component class.

I think the last time I tried this I attempted to work WP_Query in the 
project as well as it was far too much rewriting. The goal should be to 
get closer to an simpler MVC implementation.

Jacob Santos



Otto wrote:
> Can somebody explain what the issue is here, to me?
>
> All I've ever done to mess with rewrite rules is to call the
> add_rewrite_rule function on an init hook. If I wanted to do whole
> custom pages based on that, I'd probably use template_redirect for it.
>
> I've never seen any need to mess with global variables. What are you
> trying to do, exactly?
>
> -Otto
>
>
>
> On Thu, Nov 19, 2009 at 8:24 AM, scribu <scribu at gmail.com> wrote:
>   
>> +1 on revamping the Rewrite API, or at the very least finishing it.
>> You shouldn't have to call various global variables to get the job
>> done.
>>     
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>   


More information about the wp-hackers mailing list