Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Drupal Views VS templating

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?

like image 858
JeroenEijkhof Avatar asked Mar 14 '26 01:03

JeroenEijkhof


1 Answers

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.

like image 156
Mike Crittenden Avatar answered Mar 16 '26 07:03

Mike Crittenden



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!