开发者

Drupal View Output

开发者 https://www.devze.com 2023-01-14 16:32 出处:网络
First let me start by saying that Im trying to find the best practices in themeing views and it has been torture, its seems theres a million ways to do anything in Drupal and none better than the othe

First let me start by saying that Im trying to find the best practices in themeing views and it has been torture, its seems theres a million ways to do anything in Drupal and none better than the other... but heres the issue.

Im developing a site. Each "area" of the site will have its own content type. Each content type will have its own VIEW with multiple displays.

Im using ROW STYLE: NODE. I can theme the FULL NODE using NODE-VIEW-VIEWNAME.tpl.php, but how would I theme the individual displays?

Views suggests that I use node templates in the "Theme Information" area so thats what Im doing. I suppose that it would just be NODE-VIEW-VIEWNAME--.... but not sur开发者_运维知识库e.

Thanks in advance.


Using templates is the way to go, unless you want to have a view that has conditional statements to test what page-layout really should be loaded. But keeping isolated tpl's can be really good.

For the sake of reducing the amount of templates. I would look across all your views and node types and look for which one have a layout and data in common. Then try to find how many views would be needed and start with the on that has highest impact (can be used for most node types and situations). That should mitigate the problem of having messy template files all over your theme.

To understand how to do this you should first read this article (helped me a lot) that clearly talks about views and naming conventions to be used to target the maximum and correct set of view pages.

There also more resources for you to draw from:

  • http://groups.drupal.org/node/10129
  • How to quickly theme a view?

Cheers!


If you find View themes a difficult challenge I suggest you take a look at the Display Suite module. It works extremely well when combined with with views, allowing you to create multiple view modes for a view, each with different layouts and included field sets. Then alternate layouts can easily be created for different blocks using the same master view. No complicated template code required.

0

精彩评论

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

关注公众号