[wp-hackers] One CMS to Rule Them All (was This was painful to read...)

Otto otto at ottodestruct.com
Thu Dec 3 18:26:41 UTC 2009


On Thu, Dec 3, 2009 at 12:01 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> Every site I've come across needs it, bar none.  Most blog sites don't, but any every website that is doing something besides blogging needs it.

I think I need to quote myself here.
"We're not trying to build "one CMS to rule them all" here. WordPress
is not, and should not be, all things to all people. There's plenty of
room for specialization."

WordPress is primarily a blogging platform. Yes, you can build any
sort of thing out of WordPress, if you like, but perhaps you shouldn't
always do that.

> And it's the most common use case for when WordPress doesn't *already* handle the URL in an acceptable way. (Can you propose a more common use case where WordPress doesn't already handle the URL in an acceptable way?)

The most common use case I've seen is where people want to customize
the URL to pull specific posts or sets of pages or what have you. Most
of these are pretty easy, and don't necessarily involve custom post
types.

The most common case I've seen for plugins to use it is to create
their own subset of pages to display whatever. Like an image gallery,
for example. It takes over the /gallery/* set of pages, redirects to
itself, and does whatever it likes.

>> Yes, a variable template. As in maybe I have a products directory, and
>> whatever.php is inside it. I can also have an index.php inside it as a
>> fallback position, perhaps. This is how much of the theme hierarchy
>> works, after all.
>
> Then you misunderstand how URL templates work.  You specify them from specific to general.
> You handle the use-case you refer to by adding another custom url definition, not by making
> each custom url overly complicated to specify.

Total nonsense. Utter gibberish. You're making things way too complex
and slow by doing that. What if I have 20000 products, after all?
Better to match /products/* once and then redirect based on the
contents of the * piece than to define 20000 separate rules of
/products/1, /products/2 and so forth..

Example: I want /products/whatever to redirect to
products/whatever.php in my theme directory. If whatever.php doesn't
exist, then use the products/index.php instead.

Code to do it for ALL arbitrary whatever's:
function plugin_add_custom_urls() {
 add_rewrite_rule('products/(.*)[/]?$', 'index.php?product=$matches[1]', 'top');
 add_rewrite_tag('%product%','.*');
}
add_action('init', 'plugin_add_custom_urls');

function plugin_add_template() {
 $product = get_query_var('product');
 if (!empty($product)) {
   locate_template(array("products/$product.php","products/index.php"), true);
   exit;
 }
}
add_action('template_redirect', 'plugin_add_template');

Just that easy.

>> add_rewrite_endpoint('foo-page', EP_ROOT);
>
> Easily for you.  Not easily for most themers.

One line of code, which I just gave to you and the rest of the
internet, is somehow hard to modify?

> Insane?  It's nice to see you can be condescending without saying anything of substance.  I'll try to refrain from doing this same.

Hey, I calls 'em like I sees 'em. I think it is slightly insane to go
to extreme lengths to wrap things and make them more complicated and
less capable in the process.

> It already exists, and is too complex for the average person to use in a theme.

This is only your opinion. Please stop treating it like some kind of
Truth handed down from up on high, when it is no such thing. Thanks.

>> - Layers make things slower. This is just a fact. More code = more
>> memory used = slower.
>
> Not necessarily.  It depends on how the layer is implemented.

False. Layers *ALWAYS* make things slower. This is easy to prove.
Method 1: I execute code A.
Method 2: I call layer B which in turn executes code A.

Method 2 is always slower than method 1. Furthermore. Method 2
implements code designed to abstract portions of the underlying code,
which takes time to run. Making it even slower.

ALL layers are slower than bypassing them, by definition. That's just
one argument though, it's not a critical indictment against layers as
a concept.

> So we are enforcing an orthodoxy, are we?

No, we're just not encouraging one. That was sort of my point.

> It *IS TOO BLOODY COMPLICATED*!!!

Your opinion again.

>How many WordPress websites are using URL rewriting right now?!?

Well, I'd say almost all of them use it in one form or another,
actually. Of course, they do it through plugins, generally speaking,
but hey. Anybody running an image gallery plugin, off the top of my
head, is using URL rewriting to some degree.

Why don't you search the plugin svn repo for how many instances you
can find of "add_rewrite" and see what you come up with?

> As respectfully as I can be, I think you are in a bubble.

I would say the same back to you, but I think we're past that point.

Nice having this chat with you, but we're done now.

> Well, we must disagree on this.  I'll submit a patch when I can; feel free to do your best to block it if you must.

Stop taking things personally. I'm not against *you*, I'm against
*your idea*. I'm all for improving WordPress. I just don't think that
this idea is an improvement.

-Otto
Sent from Memphis, TN, United States


More information about the wp-hackers mailing list