I wanted to display a table vertically and I found some code to do so, but I'm getting the following error:

warning: Invalid argument supplied for foreach() in site/modules/views/theme/views-view-table.tpl.php on line 35.

Line 35 contains the following code: <?php foreach($row['title'] as $title): ?>.

If I comment out that line, the table stops to be displayed vertically. I read on drupal.org forums that modifying the user's view permissions was a way to resolve, but I granted all permissions to views and I am still getting the same error.

How can I avoid the error appears?

  • Could you post more of the code? foreach() normally interates over an array. Seems like $row['title'] is not an array.
    – nonsenz
    Commented May 11, 2011 at 6:02

1 Answer 1


I fixed it..anyone using views hacks will need to nest the above statement in an php if statement to ensure there is data in the array.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.