3 ms·
Why bother? You could go a long way and make things clearer by giving the functions better, new names and deprecating the old ones. "Rewrite with OOP and MVC" i
by Robin_Message 16y ago
Why bother? You could go a long way and make things clearer by giving the functions better, new names and deprecating the old ones. "Rewrite with OOP and MVC" is an easy, whiny, pointless suggestion. Wordpress is warty, but it doesn't need a rewrite.
- byoung2 16y agoRewrite with OOP and MVC" is an easy, whiny, pointless suggestion Separating the design from the code would make it a lot easier for designers to create themes without having to worry about PHP. A proper templating system like Smarty would make a huge improvement with its built-in modifiers. For example: <?php $title = the_title( "<h1>", "</h1>", true ); if(strlen($title > 80) { echo(substr($title, 0,80)."..."); } ?> Would be this if Wordpress used Smarty: <h1>{{$TITLE|truncate}}</h1> This makes any display logic in the templates more portable when switching themes as well, because designers will be less prone to putting that code in header.php or single.php.
- Robin_Message 16y agoI agree, but the point is it is not a rewrite to add a templating engine to Wordpress; in fact it would be a (relatively) simple additional theme style that could co-exist with the existing PHP themes.
- byoung2 16y agoin fact it would be a (relatively) simple additional theme style that could co-exist with the existing PHP themes In the process of adding a templating system to Wordpress you would come across many instances where you'd wish that instead of having to bother with structures like: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> ...add posts to an array, then assign to template... The developers had just used an object model that let you do something like: $smarty->assign('POSTS',Post::getRecent(10)); And then access them in the template like this: {{foreach from=$POSTS item=post name=posts}} <h2>{{$post->title|truncate}}</h2> <p>{{$post->content}}</p> {{$post->url->permalink}} {{/foreach}}
- westi 16y agoWe don't use Smarty for a number of reasons. Anyway PHP is itself designed as a Templating language and works very well. Adding Smarty or any other templating language into the mix just means that users and developers have to learn both PHP and the templating language.