Field name in view template woes
I have a view row template, and one of the fields in the row is an imagecache version of a cck image. If I elect for the field settings of it to allow it to be shown, the image appears. It does not, however, appear in a dump of the $rows object, whether the field is excluded from being displayed or not. In following the naming convention of other content, and going by a dump of $view where the table name for the field is node_data_field_image_cache and the field name is field_image_cache_fid, I have tried setting the field in the view settings to be excluded from display, and then print it manually in the template. I've tried both $row->node_data_field_image_cache_field_image_cache_fid and $row->node_data_field_image_cache_field_image_cache with neither working.
Jeff Greenberg wrote:
I have a view row template, and one of the fields in the row is an imagecache version of a cck image. If I elect for the field settings of it to allow it to be shown, the image appears. It does not, however, appear in a dump of the $rows object, whether the field is excluded from being displayed or not.
In following the naming convention of other content, and going by a dump of $view where the table name for the field is node_data_field_image_cache and the field name is field_image_cache_fid, I have tried setting the field in the view settings to be excluded from display, and then print it manually in the template. I've tried both $row->node_data_field_image_cache_field_image_cache_fid and $row->node_data_field_image_cache_field_image_cache with neither working.
Look at $view->fields['field_id_of_the_field'] -- items that have to get data from a secondary query -- which includes any CCK field that may be multiple, for example -- will store its data in whatever format it needs on its own object via the pre_render() function.
On 12/31/2009 1:04 AM, Earl Miles wrote:
Look at $view->fields['field_id_of_the_field'] -- items that have to get data from a secondary query -- which includes any CCK field that may be multiple, for example -- will store its data in whatever format it needs on its own object via the pre_render() function.
In fact, the image field can be multiple, and is set in the view to show 1 image. I added a dump of $view->fields, and it's empty. So if I include the image for display, it shows when I print $content, even though I've created $content without explicitly including it in the statement.
Jeff Greenberg wrote:
On 12/31/2009 1:04 AM, Earl Miles wrote:
Look at $view->fields['field_id_of_the_field'] -- items that have to get data from a secondary query -- which includes any CCK field that may be multiple, for example -- will store its data in whatever format it needs on its own object via the pre_render() function.
In fact, the image field can be multiple, and is set in the view to show 1 image. I added a dump of $view->fields, and it's empty. So if I include the image for display, it shows when I print $content, even though I've created $content without explicitly including it in the statement.
Sorry, I typo'd. $view->field[...]
On 12/31/2009 11:34 AM, Earl Miles wrote:
In fact, the image field can be multiple, and is set in the view to show 1 image. I added a dump of $view->fields, and it's empty. So if I include the image for display, it shows when I print $content, even though I've created $content without explicitly including it in the statement.
Sorry, I typo'd. $view->field[...]
Thanks, Earl ... what a difference an 's' makes! I found that in the field, there is a [last_rendered] which has the image. So, for my next clueless act, here is the follow-on to this, which is even more confusing to me. This is a grid display. Only one of the nodes on the first page actually -has- an image, and it is the final cell. If I create views-view-field--product-catalog--page--field-image-cache-fid.tpl.php and in it, display the nid, I only get the display once, for the node with the image, not for any of the other cells. I infer from this that the template isn't used if there is no image, which makes sense. However, on the page, the cells for which there is no image end up displaying the alt text. What would the template file name need to be so that if I displayed the nid it would display it for all those other cells - the template in which I can set $output to '' to -not- print the alt text?
participants (2)
-
Earl Miles -
Jeff Greenberg