开发者

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜