Creating Widgets - Imagineering new functionality
Creating widgets is probably the best feature of Jadu. Depending on your programming expertise, you can create some pretty incredible functionality for your site. A perfect example of this is this page on our site - http://www.messiah.edu/offices. This entire page is 1 widget I built that interfaces with the Jadu Directories. Below are two links to the same directory and what it would look like if we had used the default / out of the box (OOTB) view(s) :
Default directory view : http://www.messiah.edu/directory/6/office_directory
Default a-z view : http://www.messiah.edu/directory/6/a_to_z
Both of these are completely fine, I have no issues with how this renders, but Messiah College had gotten used to an 'all in your face' list of links, with social network icons all linked up (if a department / office has one).
This is a very involved widget, and requires more than the standard public.php and secure.php files you use. It does NOT require any code modifications to core Jadu, however it DID require me to drop a new PHP class file on the server.
This new class uses the core database connection, with custom sql queries to pull the list so I can access it from my widget. The php code in the widget spins through the data, and build and renders the HTML to the screen.
Another example of the awesome flexibility of widgets is something we used in multiple widgets - the ability to pull content in from other places, for example Wordpress. Since you can access an RSS feed from most Wordpress installations you can then publish that content in your Jadu site. I guess the first question you're asking is why would you want to continue using Wordpress for content? We have multiple blogs that various on and off-campus people contribute to, and didn't want to have to teach them Jadu right away. We were just getting used to how it works, and still were figuring things out, and didn't want to add to the confusion.
I created a widget - which again required a new class file placed on the server (not all of them do, and in fact, most of ours do not). This one pulls and parses an RSS feed - similar to the popular Magpie project. Then I built widget properties (in secure.php) to allow the editor to choose which blog to pull a feed from. Instead of allowing them to enter ANY rss url, we just list our own blogs (for now) and let them pick. That's it. When they save it, it'll pull that feed and display the image, title, and summary of the post on the site, with a link off to the actual article. This could be expanded to choose image/no image, justification of text, position of image, how many posts to show, alternate images for each post, etc.
The last widget I'll ramble on about is our Profile/Biography widget. This is the most flexible, and somewhat intense one I've built. Probably intense, because it was one of the first ones I built, and I was still learning. Now, it would take a few hours I bet. This particular widget lets an editor choose an image from the image library, and assign content to any one of 16ish fields, from image alignment, content alignment, names and biography, to ticket sale information, location, and quote text. If fields are left blank, they are ignored, if they are filled in, obviously they are rendered. You have to deal with some special cases when items are left empty, make sure things line up based on the options you choose for the widget. It was somewhat frustrating to figure out because I was new.
Widgets seem to be the easiest way to extend the functionality of the product, allow you to interact the rendering of the page, and add value to your site. They are limited simply by your imagination (and/or the imagination of the managers above you). If its the later, you're either in for a big surprise and a log of work, or nothing at all because they lack vision and imagination :)
In the next article I'll cover some hints, tips and tricks I've learned when building widgets. Share some mistakes and frustrations that will hopefully help you not make the same mistakes, or at least know what you're up against.
Think big, think flexible and Jadu It.
