I would like to create a block that contains some nodes in a grid. Each node has a title, a tooltip, and a URL which is a computed field based on a non-Drupal database. We can get all those elements to appear in a table view, so the elements themselves are working. However, when I try to create a theme for them, each table data in the grid contains only $item. I need to generate something like this:

<a href="<?php print THE_URL; ?>" title="<?php print THE_TOOLTIP; ?>"><?php print THE_TITLE; ?></a>

I can't find any examples of $item working as an array from which parts can be grabbed individually. All the examples I can find involve $fields in tables. Judging from what I can see with a table-based version of the view, it seems as though something like print $item['field_tooltip_value']; might work, but it doesn't.

Can the $item variable even be used in this way? When I look at it in Devel, it seems as though the entire row is already assembled. (BTW, I tried inserting the drupal_set_message line suggested here, but nothing appears.)

Comments

merlinofchaos’s picture

Status: Active » Fixed

I believe $item will be the result of a template that's views-view-fields.tpl.php -- that's the one where you would change what each item is composed of.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.