I created a view that places a series of thumbnail pics along with a link (title & url) into a table with 3 columns. The preview of the view looks fine. I placed the view block into my rightside bar and received the following error:
warning: Invalid argument supplied for foreach() in sites/all/modules/views/theme/views-view-table.tpl.php on line 24.
I'm not sure whether this is a Views or CCK issue, so I have posted here.
< ?php
$view = new view; $view->name = 'Video_Thumb_Links'; $view->description = 'View of the IFV Video Thumbnail Pics & Links for Right Sidebar'; $view->tag = 'Video Thumb Links'; $view->view_php = ''; $view->base_table = 'node'; $view->is_cacheable = FALSE; $view->api_version = 2; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ $handler = $view->new_display('default', 'Defaults', 'default'); $handler->override_option('fields', array( 'field_videopic1_fid' => array( 'label' => '', 'alter' => array( 'alter_text' => 0, 'text' => '', 'make_link' => 0, 'path' => '', 'alt' => '', 'prefix' => '', 'suffix' => '', 'help' => '', 'trim' => 0, 'max_length' => '', 'word_boundary' => 1, 'ellipsis' => 1, 'strip_tags' => 0, 'html' => 0, ), 'link_to_node' => 0, 'label_type' => 'custom', 'format' => 'image_imagelink', 'multiple' => array( 'group' => TRUE, 'multiple_number' => '', 'multiple_from' => '', 'multiple_reversed' => FALSE, ), 'exclude' => 0, 'id' => 'field_videopic1_fid', 'table' => 'node_data_field_videopic1', 'field' => 'field_videopic1_fid', 'relationship' => 'none', ), 'field_videolink1_url' => array( 'label' => '', 'alter' => array( 'alter_text' => 0, 'text' => '', 'make_link' => 0, 'path' => '', 'alt' => '', 'prefix' => '', 'suffix' => '', 'help' => '', 'trim' => 0, 'max_length' => '', 'word_boundary' => 1, 'ellipsis' => 1, 'strip_tags' => 0, 'html' => 0, ), 'link_to_node' => 0, 'label_type' => 'custom', 'format' => 'default', 'multiple' => array( 'group' => TRUE, 'multiple_number' => '', 'multiple_from' => '', 'multiple_reversed' => FALSE, ), 'exclude' => 0, 'id' => 'field_videolink1_url', 'table' => 'node_data_field_videolink1', 'field' => 'field_videolink1_url', 'relationship' => 'none', ), 'field_videopic2_fid' => array( 'label' => '', 'alter' => array( 'alter_text' => 0, 'text' => '', 'make_link' => 0, 'path' => '', 'alt' => '', 'prefix' => '', 'suffix' => '', 'help' => '', 'trim' => 0, 'max_length' => '', 'word_boundary' => 1, 'ellipsis' => 1, 'strip_tags' => 0, 'html' => 0, ), 'link_to_node' => 0, 'label_type' => 'custom', 'format' => 'image_imagelink', 'multiple' => array( 'group' => TRUE, 'multiple_number' => '', 'multiple_from' => '', 'multiple_reversed' => FALSE, ), 'exclude' => 0, 'id' => 'field_videopic2_fid', 'table' => 'node_data_field_videopic2', 'field' => 'field_videopic2_fid', 'relationship' => 'none', ), 'field_videolink2_url' => array( 'label' => '', 'alter' => array( 'alter_text' => 0, 'text' => '', 'make_link' => 0, 'path' => '', 'alt' => '', 'prefix' => '', 'suffix' => '', 'help' => '', 'trim' => 0, 'max_length' => '', 'word_boundary' => 1, 'ellipsis' => 1, 'strip_tags' => 0, 'html' => 0, ), 'link_to_node' => 0, 'label_type' => 'custom', 'format' => 'default', 'multiple' => array( 'group' => TRUE, 'multiple_number' => '', 'multiple_from' => '', 'multiple_reversed' => FALSE, ), 'exclude' => 0, 'id' => 'field_videolink2_url', 'table' => 'node_data_field_videolink2', 'field' => 'field_videolink2_url', 'relationship' => 'none', ), 'field_videopic3_fid' => array( 'label' => '', 'alter' => array( 'alter_text' => 0, 'text' => '', 'make_link' => 0, 'path' => '', 'alt' => '', 'prefix' => '', 'suffix' => '', 'help' => '', 'trim' => 0, 'max_length' => '', 'word_boundary' => 1, 'ellipsis' => 1, 'strip_tags' => 0, 'html' => 0, ), 'link_to_node' => 0, 'label_type' => 'custom', 'format' => 'image_imagelink', 'multiple' => array( 'group' => TRUE, 'multiple_number' => '', 'multiple_from' => '', 'multiple_reversed' => FALSE, ), 'exclude' => 0, 'id' => 'field_videopic3_fid', 'table' => 'node_data_field_videopic3', 'field' => 'field_videopic3_fid', 'relationship' => 'none', ), 'field_videolink3_url' => array( 'label' => '', 'alter' => array( 'alter_text' => 0, 'text' => '', 'make_link' => 0, 'path' => '', 'alt' => '', 'prefix' => '', 'suffix' => '', 'help' => '', 'trim' => 0, 'max_length' => '', 'word_boundary' => 1, 'ellipsis' => 1, 'strip_tags' => 0, 'html' => 0, ), 'link_to_node' => 0, 'label_type' => 'custom', 'format' => 'default', 'multiple' => array( 'group' => TRUE, 'multiple_number' => '', 'multiple_from' => '', 'multiple_reversed' => FALSE, ), 'exclude' => 0, 'id' => 'field_videolink3_url', 'table' => 'node_data_field_videolink3', 'field' => 'field_videolink3_url', 'relationship' => 'none', ), )); $handler->override_option('sorts', array( 'status' => array( 'id' => 'status', 'table' => 'node', 'field' => 'status', ), 'created' => array( 'order' => 'ASC', 'granularity' => 'second', 'id' => 'created', 'table' => 'node', 'field' => 'created', 'relationship' => 'none', ), )); $handler->override_option('filters', array( 'type' => array( 'operator' => 'in', 'value' => array( 'video_thumb_pic' => 'video_thumb_pic', ), 'group' => '0', 'exposed' => FALSE, 'expose' => array( 'operator' => FALSE, 'label' => '', ), 'id' => 'type', 'table' => 'node', 'field' => 'type', 'relationship' => 'none', ), )); $handler->override_option('access', array( 'type' => 'none', )); $handler->override_option('title', 'IFV Videos'); $handler->override_option('use_pager', '1'); $handler->override_option('use_more', 1); $handler->override_option('style_plugin', 'table'); $handler->override_option('style_options', array( 'grouping' => '', 'override' => 1, 'sticky' => 0, 'order' => 'asc', 'columns' => array( 'field_videopic1_fid' => 'field_videopic1_fid', 'field_videolink1_url' => 'field_videopic1_fid', 'field_videopic2_fid' => 'field_videopic2_fid', 'field_videolink2_url' => 'field_videopic2_fid', 'field_videopic3_fid' => 'field_videopic3_fid', 'field_videolink3_url' => 'field_videopic3_fid', ), 'info' => array( 'field_videopic1_fid' => array( 'separator' => '
', ), 'field_videolink1_url' => array( 'sortable' => 0, 'separator' => '', ), 'field_videopic2_fid' => array( 'separator' => '
', ), 'field_videolink2_url' => array( 'sortable' => 0, 'separator' => '', ), 'field_videopic3_fid' => array( 'separator' => '
', ), 'field_videolink3_url' => array( 'sortable' => 0, 'separator' => '', ), ), 'default' => '-1', )); $handler->override_option('row_options', array( 'inline' => array(), 'separator' => '', )); $handler = $view->new_display('block', 'Block', 'block_1'); $handler->override_option('items_per_page', 3); $handler->override_option('block_description', ''); $handler->override_option('block_caching', -1); $handler = $view->new_display('page', 'Page', 'page_1'); $handler->override_option('path', 'content/video-thumbpic-links'); $handler->override_option('menu', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, 'name' => 'navigation', )); $handler->override_option('tab_options', array( 'type' => 'none', 'title' => '', 'description' => '', 'weight' => 0, )); ?>
SELECT node.nid AS nid,
node_data_field_videopic1.field_videopic1_fid AS node_data_field_videopic1_field_videopic1_fid,
node_data_field_videopic1.field_videopic1_list AS node_data_field_videopic1_field_videopic1_list,
node_data_field_videopic1.field_videopic1_data AS node_data_field_videopic1_field_videopic1_data,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_videopic1.field_videolink1_url AS node_data_field_videopic1_field_videolink1_url,
node_data_field_videopic1.field_videolink1_title AS node_data_field_videopic1_field_videolink1_title,
node_data_field_videopic1.field_videolink1_attributes AS node_data_field_videopic1_field_videolink1_attributes,
node_data_field_videopic1.field_videopic2_fid AS node_data_field_videopic1_field_videopic2_fid,
node_data_field_videopic1.field_videopic2_list AS node_data_field_videopic1_field_videopic2_list,
node_data_field_videopic1.field_videopic2_data AS node_data_field_videopic1_field_videopic2_data,
node_data_field_videopic1.field_videolink2_url AS node_data_field_videopic1_field_videolink2_url,
node_data_field_videopic1.field_videolink2_title AS node_data_field_videopic1_field_videolink2_title,
node_data_field_videopic1.field_videolink2_attributes AS node_data_field_videopic1_field_videolink2_attributes,
node_data_field_videopic1.field_videopic3_fid AS node_data_field_videopic1_field_videopic3_fid,
node_data_field_videopic1.field_videopic3_list AS node_data_field_videopic1_field_videopic3_list,
node_data_field_videopic1.field_videopic3_data AS node_data_field_videopic1_field_videopic3_data,
node_data_field_videopic1.field_videolink3_url AS node_data_field_videopic1_field_videolink3_url,
node_data_field_videopic1.field_videolink3_title AS node_data_field_videopic1_field_videolink3_title,
node_data_field_videopic1.field_videolink3_attributes AS node_data_field_videopic1_field_videolink3_attributes,
node.status AS node_status,
node.created AS node_created
FROM node node
LEFT JOIN content_type_video_thumb_pic node_data_field_videopic1 ON node.vid = node_data_field_videopic1.vid
WHERE node.type in ('video_thumb_pic')
ORDER BY node_status ASC, node_created ASC
Any help is much appreciated.Thanks!
Comments
Comment #1
SDM-MINK commentedCan anyone provide assistance regarding this matter?
Comment #2
jamesmcd commentedJust had the same sites/all/modules/views/theme/views-view-table.tpl.php on line 24.
Any luck on a resolution for this?
Comment #3
bdimofte commentedI've just had the same problem, the theme tried to access undefined variables ($header is the one at line 24). I realized that happened only for some user roles. So, I went to the "user permissions" page and there it was... I had a lot of "view field_x" checked only for admin.
Look there, maybe you've been as absent-minded as I've been :)
Comment #4
jamesmcd commentedYes, I realised this when I signed out and noticed some of the data wasn't showing up in the views I had created.
Thanks for clarifying!
Comment #5
Ashford commentedSearching and noticed this problem was solved. Tagged it as fixed. I hope that is helping and not over stepping my bounds as a generalized Drupal Forum member.
Comment #7
seanenroute commentedTo clarify for anyone coming to this page later. More than likely you just enabled the 'Content Permissions' module. It automatically sets the cck fields to viewable by admin only. The solution is to go to 'user permissions' and enable the cck fields to viewable.
Happy Drupaling ^^
Comment #8
luco commentedactually, I found out this can also be caused if you don't use content permissions - like me.
in my table I was placing all fields in the same column - which was excluded from display since it was a grouping field.
as it turns out it was a misconception of mine. I was supposed to have a grouping field, but each field in its own column. in this way I could safely exclude one of them from display. plus the table looks neater now ;]
btw my example is a table for the weekly schedule of a gym. so there's columns for days and each day has classes organised by time, type of exercise and teacher.
hope this helps. and like seanenroute pointed out, "Happy Drupaling ^^"
Comment #9
bryanb229 commentedThis seems to still be happening to me despite disabling content permissions and trying to code it out with CSS instead of excluding from the views display.
It's really taxing my error logs.
Working hard to find a solution asap, will update this post as needed.
Anyone that has any insight would be much appreciated.
Comment #10
jaydaley commentedI encountered it when I put all my fields into one column in a table view and fixed it by splitting it into three columns, the first one of which is for a non-viewable field.
Comment #11
tmsimont commentedthis isn't fixed -- i'm seeing the same thing. i get it when putting 3 field values into 1 cell of a table output. I don't have content permisssions nor do i have field level permissions.
i read here that you can fix it by splitting the values into their own columns, but that seems like a bug to me if the settings that should work (grouping multiple fields into a single cell) create errors.
it may be related to the fact that some nodes don't have the field i'm trying to show. if this is the case, there shouldn't be an error. looks like there needs to be an
isset()check in here somewhere.Comment #12
tmsimont commenteddrop this in your theme folder (perhaps views should be shipped with this?)
views-view-table.tpl.php:
Comment #13
laraz commentedThe problem is because the user don't have permission in the fields that want to see in the view.
Comment #14
Anonymous (not verified) commented#12 fixed it for me. Thanks!
Comment #15
dawehnerUpdate status.
Does someone know whether this still applies to 2.x-dev? As far as i remember there was a similar issue for views3, and it got fixed there already.
Comment #16
esmerel commented