views:

39

answers:

1

I have recently started working with Drupal on the side and have had to tackle the limitations I come up against in the Views API. More than not I find it faster and more powerful to code it myself.

  1. It is hard to create custom views that have a specific look and feel without create custom files anyway.
  2. Creating the pages from scratch in a *.tpl.php gives me more choice and flexibility. I have done a couple of them now and it is almost as fast.

For a developer (since this is a programming forum) what is better in your opinion:
Views or Custom templates?

+3  A: 

I'm not even sure what you mean by custom templates (please say you're not hardcoding SQL into .tpl.php files), but no matter what you mean, the answer is to use Views wherever possible.

Reasons:

  • Development speed - I promise you creating a View will be faster than a custom module 99.9% of the time
  • Stability - it has hundreds of thousands of testers
  • Security - it has the eyes of many on its code
  • Support - there are hundreds of contrib modules that interact with Views somehow
  • Maintenance - Views is a Drupal standard. Using custom modules gives your site's maintenance an unnecessary learning curve.
  • Upgrading - Views will provide an upgrade path from D6 to D7. Your custom stuff won't.

As for your "it is hard to create custom views that have a specific look and feel" point, I think you'll change your mind after a little time with template_preprocess_whatever() functions and overriding Views templates. You have absolute control if you want it.

Mike Crittenden
To clarify what I mean is simply that I cannot do what I would like to in views. It's not flexible enough and requires a lot of learning in the beginning. And I'm not talking about creating modules, simply replacing certain nodes and elements in the page with tpl.php files - I guess you call it theme, although for me it comes down to functionality.
WmasterJ
@WmasterJ, I still don't understand the problem. Views can handle 99% of tasks that involve listing things, and it requires less learning than writing it yourself.
Mike Crittenden
@Mike, I will take your and other peoples word on this and try to get onboard with Views more. Need to learn what the template_preprocess_x() functions will do for me. Thanks for the feedback.
WmasterJ

related questions