[wp-hackers] The problem with WP_Rewrite <<< RE: Options for Controller - Views

Christopher O'Connell jwriteclub at gmail.com
Thu Dec 3 19:18:04 UTC 2009


Your argument just doesn't make sense. By your logic, we shoudn't abstract
away SQL, because "if a person is not capable of understanding SQL, and
can't look in a book for 10 minutes to figure out what they want to do, then
they should not be writing code of any kind. They should stick to something
simple, like flipping burgers."

The reason we abstract stuff away is to simplify programming. It's a common
use case to redirect a URL to a controller (and that's what it is, no matter
what you want to call it). It should therefore be simple. I don't know how
they do things in the South, but out west a couple of dozen lines of code
including RegEx is NOT SIMPLE! Indeed, it's so not simple, that it's broken.

Mike: I'll be happy to help out in a week or so.

~ Christopher

P.S. Brewing beer, is, IMHO much simpler than RegEx

P.P.S. This reminds me of the discussions on some of the linux boards about
how "including a graphical package manager is totally unneccessary, because
there's a command line one".

... To be quite blunt, if a person is not capable of understanding
> regular expressions, and can't look in a book for 10 minutes to figure
> out what they want to do, then they should not be writing code of any
> kind. They should stick to something simple, like flipping burgers.
> Obviously, I don't expect an end user to understand regular
> expressions. I wouldn't want people making fields to put regexp on the
> admin screens, for example.
> But there's a certain level of knowledge you need to obtain to write
> code, and to write PHP code in particular. Simple Regular Expressions
> is one of those most basic levels of things you need to know, just
> after string handling.
> Do I expect a plugin author to understand regexp? Absolutely.
> Do I expect a theme author to understand regexp? No.
> Do I expect them to be able to ask somebody or Google search to find
> examples? Yes.
> >> The post_type variable is supported in 2.8, but *custom* post_type
> >> support wasn't added until 2.9.
> >
> > But it still doesn't work in 2.8, right?   At least it didn't work when I
> tried to use the URL with a post_type parameter on an existing live site.
>  Anyway, not important.
> No, it works in 2.8 just fine, but the post_type must be "post", or
> "page", or "attachment", etc. Basically, wp_query didn't like anything
> but the various built in ones.
> > Conversely I'm floored by your adamancy about not wanting to make this
> common need approachable.  The code you mention is fine for plugins but not
> fine for themes.
> The code I mentioned was *far* more appropriate for themes than for
> plugins, because it's creating specific conditions that the theme must
> satisfy (like having a custom/products.php file in it, for example).
> And it didn't even require regexp.
> > The skill level for PHP coding among plugin developers is much higher
> than for your *average* themer who in many cases use cuts and pastes PHP
> code from examples...
> What's wrong with them cut and pasting the example from somewhere and
> modifying it to their needs?
> More to the point, what makes you think a theme author isn't going to
> do the same with your add_custom_url nonsense, eh? You've got a ton of
> "magic" words in there... url-type, callback, single-post, etc, etc.
> And it's using an array as well.
> I am really not seeing why you think your method is any easier or less
> complicated, especially if you're going to assume that the theme
> author doesn't know PHP all that well. Heck man, theme authors cut and
> paste the register_sidebar calls for their functions.php files all the
> time, and they're about as complex as your add_custom_url is.
> -Otto
> Sent from Memphis, TN, United States
> _______________________________________________
> 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