Warning: Invalid argument supplied for foreach() in
Bonjour,
J'ai installé Joomla en local avec WampServer Version 2.1 - php 5.3.5 - mysql 5.5.8. J'ai aussi installé un module qui est censé m'afficher un tableau (dates + heures) ce tableau est rempli à l'aide d'un fichier csv que j'upload par le biais du module. Le problème est que s'il n'y a pas de données à afficher et que le module est activé, j'obtiens l'erreur suivante :
Citation:
Warning: Invalid argument supplied for foreach() in C:\wamp\www\modules\mod_joomla\tmpl\tablethree.php on line 5
Voici le contenu du fichier tablethree.php:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| <?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<table style="border-width: 0px; width: 100%">
<?php foreach ($items as $item) : ?>
<tr>
<td>
<span title="<?php echo JText::_( 'COL1' ); ?>"><?php echo JText::_( 'COL1' ); ?></span>
</td>
<td>
<span title="<?php echo JText::_( 'COL2' ); ?>"><?php echo JText::_( 'COL2' ); ?></span>
</td>
<td>
<span title="<?php echo JText::_( 'COL3' ); ?>"><?php echo JText::_( 'COL3' ); ?></span>
</td>
<td>
<span title="<?php echo JText::_( 'COL4' ); ?>"><?php echo JText::_( 'COL4' ); ?></span>
</td>
<td>
<span title="<?php echo JText::_( 'COL5' ); ?>"><?php echo JText::_( 'COL5' ); ?></span>
</td>
</tr>
<tr>
<td>
<span title="<?php echo $item->col1?>"><?php echo $item->col1?></span>
</td>
<td>
<span title="<?php echo $item->col2?>"><?php echo $item->col2?></span>
</td>
<td>
<span title="<?php echo $item->col3?>"><?php echo $item->col3?></span>
</td>
<td>
<span title="<?php echo $item->col4?>"><?php echo $item->col4?></span>
</td>
<td>
<span title="<?php echo $item->col5?>"><?php echo $item->col5?></span>
</td>
</tr>
<?php endforeach; ?>
</table> |
Que pourrais-je ajouter dans le code pour éviter ce message d'erreur et afficher un message à la place par exemple no data found?
Merci,