Hi guys. Just as I was scratching my head about this issue, I see that you release rc1, an hooray, I update it. Nonetheless, I still have the following:
I am trying to create a simple block view that randomly displays text taken from body of certain node types. Everything worked ok until at some point, the view was previewing good, the new block was displaying things as needed, until I see this error:
warning: Invalid argument supplied for foreach() in /home/hipo/public_html/sites/all/modules/views/theme/views-view-fields.tpl.php on line 22.
I have tried and looked over this in here and google, but I haven't found anything useful, as I see that this error message is a more general one. I am lost, because this is my first time trying views, and I have really struggled to figure out how to use views, because I could not find any tutorial on version 2 (by the way, excellent idea with the help system)
If would be very grateful if someone has the time to help, maybe we will also squash a bug with this occasion :) I am at your disposal with info and tryouts, if needed.
Best regards
Comments
Comment #1
merlinofchaos commentedCan you export the view you're having this trouble with?
Comment #2
Vially commentedYes, of course. Here it is:
<p>$view = new view; $view->name = 'stiati'; $view->description = 'View pentru stiati ca'; $view->tag = ''; $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( 'body' => array( 'label' => 'Body', 'exclude' => 1, 'id' => 'body', 'table' => 'node_revisions', 'field' => 'body', 'relationship' => 'none', ), )); $handler->override_option('filters', array( 'type' => array( 'operator' => 'in', 'value' => array( 'stiatica' => 'stiatica', ), 'group' => '0', 'exposed' => FALSE, 'expose' => array( 'operator' => FALSE, 'label' => '', ), 'id' => 'type', 'table' => 'node', 'field' => 'type', 'relationship' => 'none', ), )); $handler->override_option('access', array( 'type' => 'none', 'role' => array(), 'perm' => '', )); $handler->override_option('title', 'Stiati ca...'); $handler->override_option('items_per_page', 1); $handler->override_option('use_more', 1); $handler = $view->new_display('block', 'Block', 'block_1');</p>Thanks :)
P.S. The error looks exactly like this:
warning: Invalid argument supplied for foreach() in /home/hipo/public_html/sites/all/modules/views/theme/views-view-fields.tpl.php on line 22.Comment #3
Vially commentedComment #4
merlinofchaos commentedCan you turn off your wysiwyg and re-export? It messes up the formatting.
Comment #5
merlinofchaos commentedYou only have one field, the body field, and it's marked 'exclude'. That seems unwanted.
Comment #6
Vially commentedThanks for helping. I have re-exported the view without wysiwyg. The error is still there, even though I have unmarked exclude for the field...
Comment #7
Vially commentedI have reinstalled the module, and it didn't help, but I also deleted the view and recreated it 2 times, using different orders of creating it, and the second time it worked. I have the module up and running, and the view is ok. This can be closed for now.
Thanks for helping :)
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
ass45sin commentedI had this same problem.. views work out great during preview and my tests but users without proper permission can't see anything and the error message comes out. Had to give permission for users to see the content of the table created with views. Other style would just show pagers if any.
May this help other users.