84 points · by nosecreek · 13y ago · 66 comments
http://codex.wordpress.org/Version_3.5
The biggest thing I wish WordPress would add is a better built in system for real templates, using a something along the lines of Twig (http://twig.sensiolabs.org/).
That mixed PHP code and HTML in your standard WordPress template disgusts me every time I see it. I know there are some custom solutions for creating real templates in Twig, but this should be part of the mainstream WordPress branch.
Pity it's so widely used, and there's little competition...
There's still plenty of warts, of course, but that seems true of just about every widely used piece of software -- bad decisions early on in development become very hard to walk back later when any of millions of sites/themes/plugins/etc. could turn out to be depending on that bad decision being there...
http://trends.builtwith.com/cms provides some good trends of the big players, but I wouldn't put too much stock in it.
That said, as a developer who has fallen into the WordPress business out of necessity, there are a lot of great products out there that are built much better than WordPress and I wish one of them were the dominant player. Still, WP manages to get the job done most of the time.
Honest question: Can you name one?
I'm seriously looking for a WordPress alternative, but I haven't found one that is truly BETTER.
{get $blogs from "/channels/blogs/entries"}
...
Alpha version was released just yesterday, you can sign up and download it at http://getfwd.com/shameless plug
# controllers/BlogController.php
class BlogController extends AppController
{
function index ()
{
$this->entries = get("/channels/blogs/entries");
}
}
# templates/blog/index.html
{foreach $entries as $blog}
...
{/foreach}
Or, as in my example, this... # templates/blog.html
{get $entries from "/channels/blogs/entries"}
{foreach $entries as $blog}
...
{/foreach}
I've written substantial apps both ways, and so far I have found that powerful templates are actually easier to write, read, and maintain, perhaps because the entire request flow happens in a single file.I doubt Wordpress would be used for anything other than simple blogs if it weren't for querying from templates.
Obviously there is the risk of theme developers loading tons of queries from a template but I think trying to prevent that would be premature optimization. The benefit of greater customizability outweighs the potential performance hit IMO.
The template pseudo languages enforce a strict separation between model and view, and they typically do so with a much more concise syntax and legible format compared with embedding PHP in HTML, for example.
I used to prefer general languages for templating, but once I learned the pattern of using Twig to the full I found that I could create templates much faster than before, and I could also go back to a template after a couple months of not looking at it and quickly understand what I was looking at.
That leads to all sorts of debugging fun when something weird is happening, and opens up naïve users who assume that a "theme" is somehow safer than a "plugin" (because all themes do is change the look and feel, right?) to security risks from downloaded or hacked-up themes.
So much of programming is protecting the programmer from him or herself. By enforcing rules you protect yourself from bad habits. I think a separate template system and keeping the view separate would help keep everyone honest.
Eventually I started to do my modifications as plugins, which is one area where Wordpress really shines. Other systems could definitely take note of the way WP handles plugins.
In contrary, I am in the pursuit for the one universal language to be used everyhere replacing, javascript, html, css, templating language, ruby/python/php, sql..
The syntax is very Django/Jinja alike. They took good inspiration.
Meanwhile, why the Wordpress team didn't switch to a template engine and orm after all those years is a true mystery to me.
As long as you use the MVC paradigm or at-least sperate views from business and data store logic it seems like PHP works fine to do the templating its self.
Yes I can see the argument that non coders have to learn PHP, but is PHP really much harder to learn then the template language?
Also templating add's performance overhead.
What you essentially end up with is a "hypertext preprocessor preprocessor"
It's great to see Wordpress is taking steps in the right direction with every release. Another wishlist feature would be the integration of the Advanced Custom Fields plugin straight into the core which allows you to add custom meta boxes and fields to posts in a tasteful and aesthetically pleasing way. I'm excited about the future of Wordpress, it's my bread and butter and I don't see it being beat any time soon.
Re: custom fields: This makes little to no sense to be in core, because custom fields are just that, "custom". There's no point in giving the end user the ability to make their own meta boxes hooked to custom post meta if there is no plugin or theme actually using that meta data. Creating a meta box is something that the theme/plugin should do, because it's actually going to use the data gained from that meta box.
In other words, the horse goes in front of the cart, not the other way 'round.
This would allow future WordPress developers to namespace their code, and out allow simple closures withint your code.
As of PHP 5.5, there is no support for a straight mySQL connection. There is no real downside in WordPress adopting the PDO standard.
(Personally, I want it, but I can see there being friction, given the possibility of breakage.)
There are still many other issues with the code, but having a clearly defined error-handling / -signaling for plugins would be the one single change that would help in many problem areas of wordpress development - making rules and knowledge about successful plugin execution and error handling obligatory for plugin devs could be the one single change that could also help to reduce that annoying flood of unbelievable bad code to be found in WP plugins repo.
At the moment, we're not considering dropping support for PHP 5.2, so we'll likely take the best ideas and implementation from various frameworks and combine them. I'm fairly committed to reiterating wherever possible that WP isn't a silo and we need to be looking at what other PHP projects are doing. We're getting better at that.
So yeah, there is some precedent at popular CMSs using a modern framework on server, client, or both. We'll see when and if WordPress follows the example...
1) not make comments enabled out of box with no anti-spam measures (moderating isn't anti-spam in my opinion: technical solutions should come before man-power)
2) not make me rely on third-party plugins to combat it