[support] Views: is better node or fields for the "Row styles" ?

Larry Garfield larry at garfieldtech.com
Thu Oct 8 00:24:48 UTC 2009


Actually, I virtually never use "node" rows.  A node row does a full node load 
for every node that gets loaded.  A full node load could mean anywhere from 
5-15 queries depending on what modules you have installed... *per node*.  
That's in addition to the query of the view itself.  You can easily burn 100 
queries that way.

You also then cannot effectively theme the node rows separately from their 
normal "page at node/X" and teaser versions.  It uses the same theming.

With a fields-based row style, most fields (although not all) can be gotten in a 
single query for the view itself.  (The body or teaser fields still do a node 
load, which is why I never use them, and if you have a CCK field that is "group 
multiple values" then it's one extra query per row.)  You also can theme that 
individual row or the whole view or individual fields however you want 
(although generally you can do most things you want in CSS).

I've occasionally used teaser views when I had do something totally nutty, 
like embed a view within each record of a view.  I don't think I've ever done 
a full node view.  Fields all the way for me, as I can get nearly everything I 
want in a single query and be done with it.

On Wednesday 07 October 2009 2:41:02 am Michel Morelli wrote:
> Hi all, I need to create some views (I know how to make it) but I have a
> questions about performance (and maintenance). All my views need to
> create some little piece of HTML with title, image (imagecached), little
> description, link to the node. All this "fields" will be contained in a
> <div class="mystyle_for_this_div"></div>.
>
> We know that view's "Row Styles" can be "Fields" or "Node". In a case
> like this one is better to use fields or node ?
> If I choose "Fields" I may create one {template}.tpl.php file for each
> "fields" (title will be in a <h1>, little description will be in a <p>,
> etc etc).
> If I choose "Node" I may create only one node-view-MYVIEWNAME.tpl.php
> that include the HTML tags that I need.
>
> I think that in this case the better solution is node-view file. Is this
> correct ?
>
> Tnx.

-- 
Larry Garfield
larry at garfieldtech.com


More information about the support mailing list