views:

697

answers:

2

I have written a custom view template called "views-view-unformatted--FAQ.tpl.php. How can I access the nodes? The $rows array only holds the rendered content from the node.tpl.php template.

Bottom line is this - I want to organize the FAQ's into sections by taxonomy.

A: 

Try the $node variable. If you want to see what variables you have available and have the devel module installed, you can do

<?php dpm(get_defined_vars()); ?>

inside your template. This will display all of your variables. However, if you have a view with several nodes being displayed, you will probably need to do this inside the loop that is displaying them, as they wont be defined outside the loop (at least not all of them).

googletorp
A: 

You may want to look at the Grouping Field, which can be found in the Style Options. The grouping field allows you to group by any of the fields you've added (if your using a Fields Row Style view).

Otherwise if you really need access to the node object, consider switching your views Row Style to Node and then using the node template, node-node_type.tpl.php (assuming your view is of a single content type) to style each node in the view. In this case you can also set the Build Mode in the Row Style options to Teaser so that you can differentiate between the full node view and the node view when placed in the view.

Hope that helps.

m4olivei