(This post is more of a developer tip. As I encounter things that take a long time to figure out, I decided to share them with the world here in the hopes that it’ll save someone else a headache!)
Drupal is awesome and I love it for many reasons. But it’s also more of a “developer’s CMS” and isn’t all that user-friendly. And despite being on the market for a number of years, the documentation isn’t very good. On top of that changes to the API are made that overhaul how things work.
This change is mostly a good thing, but it’s hard to keep up with sometimes, especially when you use multiple CMSs, do SEO, write, design, etc. There’s just not enough time in the day to master the ever-changing complexity that is Drupal.
So I’ve decided that whenever I take an hour or so to figure something out in Drupal that I’m going to share it with the world, for my own reference as well as possibly saving someone else a headache. Here’s hoping that these help someone! 🙂
Without further blathering, here’s the Drupal tip:
——–
I installed the Drupal Fivestar module (https://drupal.org/project/fivestar) and wanted the 5 star rating to show up on a node (specifically on a product on http://thecooleststuffever.com/).
It installed really easily but then I was flummoxed, flummoxed I tell you, as to how to get the Fivestar rating to show up. I had a custom content type, node–product.tpl.php as I theme most things by using the tpl.php (I’ve heard it’s sometimes pronounced “tipple fip” :-p).
Well, I read though the readme file and there was nothing as far as how to theme Fivestar to show up. After what felt like eons of searching, I found it, and here it is:
$fivestar = field_view_field(‘node’, $node, ‘field_fivestar’);
print render($fivestar);
Very simple. That’s all it takes to get the Fivestar rating widget to show up in your tpl.php file.
Now I don’t know why more Drupal developers don’t document things better. Well, actually I do, I get it; Drupal devs are more concerned with just making things work. And they don’t think like you or I or most people – they think at a sort of “higher level”, a coder level, and they write their documentation geared towards their own.
I prefer the WordPress/Apple way of doing things. I.E. let’s make this simple, let’s make it work well, and let’s make it easy for people to use and figure out. In WordPress documentation is typically clear and concise and geared more toward the end-user.
It’s not a bad thing and I’m not trying to rip on Drupal developers. I just wish that Drupal in general was a bit easier for everyone to access and use.