The Duperrific Theme Egine is yet another WordPress Theme Framework
Well, most of them are only simple themes with a lot of hooks, not a real programming framework. Duperrific Theme Engine is (or tries very to be) a real programming framework, that tries to enhance the experience of programming WP Themes using MVCish paradigms.
MVC is a popular software programming pattern used in popular application frameworks like Ruby on Rails, CakePHP, Cappuccino and even Cocoa. It stands for Model-View-Controller, and it is all about separating the data-access, application logic and graphic interface layers. For more accurate info, Google is your friend.
The ‘ish’ part means that I’m doing my best to implement OOP and the MVC pattern to a software which really doesn’t like to be separated into layers. The result is not pure MVC, but it has a ressemblance.
Wordpress Themes were originally conceived just as something to add nice presentation to simple blogs. If everything you need is a simple list of posts and a sidebar, then everithing you need to do is a very simple theme.
But as the features grow, the complexity grows exponentially. You start making your theme SEO ready, then you need that some featured posts, then you need a thumbnail image for your post, a settings page, another loop, one widget area, another widget area, another settings page… in no time, your code has grow to the point where is unreadable and maintenance is a nightmare.
The Duperrific Theme Engine approaches themes as mini-applications that runs inside your WordPress installation. Some advanced features like widget areas, settings pages, custom field controls, multiple loops are already supported and made very easy by the framework.
No, when you download the Duperrific Theme Engine from GitHub, what you download is a starter theme, the real framework is in the DTE folder. It is initialized via the functions.php file. You could develop from here or start a completely new theme and include the DTE there.
Yes! I like, for example, place it in the wp-content folder, so it can be shared by more than one theme. Just tell where is it going to be in your functions.php folder and declare some constants. Here’s an example:
<?php
define('DUP_CORE_STYLES_URL',"http://yourdomain.com/wp-content/dte/styles/");
define('DUP_CORE_JS_URL',"http://yourdomain.com/wp-content/dte/js/");
include("/path/to/your/site/wp-content/dte/duperrific.php");
$blog = new Blog('yourThemeName');
extract($blog->getHelpers());
extract($blog->getTextDomain());
?>
Yes! Please do it and, if you find is useful – or not – you can tell me (I’m @soska on Twitter)
Grab the starter theme for this other respository, and start playing with it.
The code and the example are well commented, but I’ll try to do better documentation in the future. In the mean time, you could help me by playing with it and sending really frequently asked questions by email to arm.sosa [at] gmail [dot] com or over Twitter.