Basic idea:
I want to display a block the 3 latest blog posts from a content type called "Blog." I want to theme the way each node is displayed (so it fits in with my design).

My solution so far:
I have a view called "blog" that gets all nodes of the type "Blog." I have created "views-view--blog--block.tpl.php" and put it in a folder called "views" inside my theme folder. The contents of the file are as follows:

print '<pre>' . htmlentities(print_r($rows, 1)) . '</pre>';

This seems to work, and it prints the matched nodes.

However, I want to be able to access each node field individually so that I may place each element of each node in a certain spot within my markup. I cannot figure out how to do this.

Should I switch the row style to fields? What else should I do? Can somebody provide sample code for accessing each field of each node?

Thank you for your help.

Comments

stevenc’s picture

If you have "Row style: Fields" then the view will automatically output DIVs with class names that reflect the individual fields displayed.

Example:

<div class="views-field-title">...</div>

If this isn't sufficient, you likely want to override (i.e. copy into your Theme's folder and modify) "views-view-fields.tpl.php" as this is where the structure of the output is defined.

---------------------------------
Steven Wright

Slalom