Hi,
when creating a 'Views Flipped Table', I'm getting the following warning on every page with this table:
Warning: Invalid argument supplied for foreach() in include() (line 39 of /var/www/drupal/sites/all/modules/views_hacks/views_flipped_table/views-flipped-table.tpl.php).
The table seems to be rendered properly.
Line 39 in views-flipped-table.tpl.php is the statement <?php foreach($row['title'] as $title): ?> from this construct:
<?php if ($first):?>
<thead>
<tr class="<? echo $element; ?>">
<th>
</th>
<?php foreach($row['title'] as $title): ?>
<th>
<?php echo $title; ?>
</th>
<?php endforeach; ?>
</tr>
</thead>
I have no idea what seems to be the problem here.
Greetings, -asb
Comments
Comment #1
marc.groth commentedHi there,
I am also getting this error and it seems that it's because there is no title set for the table... I have attached a patch to fix this (by adding an if statement to make sure that $row['title'] is an array before doing a foreach() on it - which is what the error is complaining about). The patch will need to be applied to the correct folder (i.e. views_flipped_table root folder). The change is basically:
becomes
Is this intentional behaviour (i.e. the table has to have a title) or can this patch be applied? A check should probably be made to make sure something is an array before performing a foreach() on it, which will make sure this error isn't seen if the user decides not to give the table a title.
Many thanks,
Marc
Comment #2
infojunkieI fixed this using a different approach, by avoiding the title row altogether if no title field is present. Please try it 12 hours from now and let me know if it works as you expect.
Comment #3
infojunkieFixed in dev of course.
Comment #4
marc.groth commentedThanks for such a quick response infojunkie.
Do you have any idea if/when this will be rolled out into beta1? Or is it just worth using dev for now instead?
Thanks again,
Marc
Comment #5
infojunkienot sure when I'll release beta2. But dev contains no major changes compared to beta1, just bug fixes, so I think you'd be safe using it.
Comment #6
asb commentedJust upgraded to views_hacks 6.x-1.x-dev and can confirm that the error no longer appears.
Thank you!
Comment #7
marc.groth commentedThanks for the fix and information, infojunkie
Comment #9
naught101 commented