One of the greatest things about Joomla is it's extendability. If you need a forum, a shop solution, a module to display weather, etc., you can bet there's probably a solution available. With over 4,600 extensions listed in the Joomla Extensions Directory at the time of this writing, Joomla users are presented with a myriad of options to extend the base functionality of their Joomla powered site.
While having such choice is an awesome thing for the Joomla end user or site developer, it can at times present some 'formatting' issues. Often times the end user might find themselves out of luck, going back and forth between a template provider and extension developer for support, with each pointing the finger at the other as the cause of a formatting issue.
Perhaps it's time to start slicing up the status quo and approach extension 'design' from a new direction.
In a recent blog post at Gnome on the Run entitled "A Huge Joomla Extension No No", Jeremy Wilken presented his thoughts on the practice of most extension providers adding their own 'template' into their extension. Such a practice, when utilized, often overwrites the site styles that are provided in the Joomla template. Jeremy asserts that "The whole idea behind Joomla templates is to provide a single design that all elements can use to display content", and I couldn't agree more.
The separation of content from presentation is one of the greatest things about any Content Management System (CMS). Having a single extension (the Joomla template) define styles for all elements of your Joomla powered site allows for consistency across the entire site. The problem today is that there are many extension providers who, for whatever reason, feel the need to provide their own styles for common elements. Imagine if ALL 4,600+ extensions currently listed in the JED defined their own link colors, font-type or even menu formatting. In such a case, installing any number of extensions would leave you with a hodgepodge of formatting that would make your site look like an untalented grammer school student put it together.
One extension provider who is slicing up the satus quo on how extensions are styled is Ninja Forge. With their work on Ninjaboard, a Joomla forum component, they've gone through the effort of assuring the component is styled by the Joomla template. I had the privelage of asking Lead Developer Stian Didriksen a few questions about the approach he took in developing the extension:
Can you explain a bit about how you created Ninjaboard to use styles from the Joomla template?
Ninjaboard's template engine, Chameleon, split up parts of its layout into emulated module blocks, fully capable of reusing any module chrome and class suffixes the template's got to offer. For the stable release we're even adding the possibility to render parts of Ninjaboard in actual module positions. That way anything the template can do with modules, it can do with Ninjaboard.
What would be involved in converting an existing extension so that it can do what Ninjaboard does with its styling?
In order for this to be possible, it's crucial that the extension is fully MVC and using layouts appropriately for it to work. It's also helpful if you're using the Nooku Framework, so you're able to use the "load any html layout anywhere" feature. If you're not using the Nooku Framework, you would need to create something similar for it to work.
Does developing extensions with this kind of capability take more time? If so, is the time made up elsewhere?
It does take a lot of extra time but the benefits for the end-user are worth it. By using such an approach we won't have to spend extra time on collaborating templates with template vendors, as chameleon is compatible with whatever they're making without us coding specifically for a vendor, or a vendor for us. So if a template vendor wants to push the limits on what's possible with Ninjaboard, they do so by advancing their modules. And by that, users that don't use Ninjaboard will benefit just as much from that effort.
What are some possible benefits for extension developers in adopting such an approach to style their extensions?
A couple of benefits not already mentioned are better performance and a lighter footprint. By reusing this much of the template, there is very little imagery and CSS that Ninjaboard loads. This makes load times dramatically faster than you would expect. Being so easy to style make the extension very attractive for template vendors. Since it's so easy to style, it's easy for the vendor to get something up and running very fast, so it opens up new opportunities that can help promote your work.
Does using such an approach limit your flexibility as the extension developer?
The only limitation is that you can't look better than the template. If the template's got weak module styling, then the extension will suffer from it. One example is MilkyWay.
Are there benefits for the end user or Joomla site developer in using such extensions?
This is especially useful for site builders. A lot of extensions, especially boards, have companion templates. Morph is releasing a Kunena template soon. RocketTheme's got their phpBB3 theme club that releases new templates that match existing templates from their Joomla club. And we could've gone that route with Ninjaboard. But the problem is that out of all the custom templates out there, it's impossible for me to make a NB template ready for someone who use a custom design I've never used before. However, if that site's got strong module styling, the auto-skinning technique will make sure Ninjaboard look fantastic still. So for site builders this is a game changer.
Why did you choose to go about assuring the component gets styles from the template?
Interesting question. To be honest one day it just struck me, the idea that it could be possible. So I just had to try and see if it was.
And it turned out well, didn't it?
It turned out very well indeed! Anything else you would like to add?
Beta2 of Ninjaboard came out on Sunday, and features a built in Kunena importer, AJAX frontend deletion of posts, multiple attachments with acl per post, com_search integration and much more.
You can't afford to miss it!
Beta2, by the way, is the last beta. The next release is stable!
It's good to see such an approach being adopted by Ninja Forge. While it's obvious that such an approach may not be instantly adoptable, nor even feasible, for all extension developers, the idea is one that at least deserves some serious consideration. After all, isn't it our goal as developers of Joomla extensions to make the end user's experience the best it can be? And wouldn't using a single extension (the template) to style all of a site's elements assure consistency and a better experience for the end user?
*Note: Ninjaboard is still in Beta, and is not recommended for production sites. However, we do encourage readers to download and install the component, give it a try, and report any bugs to Ninja Forge in their forum
Tell us what you think? Share your ideas below, we love to read them!