diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2005-10-03 08:47:45 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2005-10-03 08:47:45 +0000 |
| commit | 4ebe764c36c0546e435c6cfa4106643f5f0be026 (patch) | |
| tree | 41878a45fc4e3830e8c8a3bbddf4eacbb56947e5 /list.php | |
| parent | 3803081ba5b9da391f81c031bf2290f63b1f5a41 (diff) | |
| download | pigeonholes-4ebe764c36c0546e435c6cfa4106643f5f0be026.tar.gz pigeonholes-4ebe764c36c0546e435c6cfa4106643f5f0be026.tar.bz2 pigeonholes-4ebe764c36c0546e435c6cfa4106643f5f0be026.zip | |
fix foreach loop on empty array
Diffstat (limited to 'list.php')
| -rw-r--r-- | list.php | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -3,7 +3,7 @@ * $Header * * @author xing <xing@synapse.plus.com> - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * @package pigeonholes * @subpackage functions */ @@ -34,14 +34,16 @@ $listHash = array( $pigeonList = $gPigeonholes->getList( $listHash, TRUE, FALSE ); // set up structure related stuff -foreach( $pigeonList['data'] as $key => $pigeonhole ) { - $gStructure = new LibertyStructure( $pigeonhole['root_structure_id'] ); - $gStructure->load(); - $pigeonList['data'][$key]['subtree'] = $gStructure->getSubTree( $gStructure->mStructureId ); +if( !empty( $pigeonList['data'] ) ) { + foreach( $pigeonList['data'] as $key => $pigeonhole ) { + $gStructure = new LibertyStructure( $pigeonhole['root_structure_id'] ); + $gStructure->load(); + $pigeonList['data'][$key]['subtree'] = $gStructure->getSubTree( $gStructure->mStructureId ); + } + $gBitSmarty->assign( 'pigeonList', $pigeonList['data'] ); } //$gBitSmarty->assign_by_ref('offset', $offset); -$gBitSmarty->assign( 'pigeonList', $pigeonList['data'] ); $gBitSmarty->assign( 'pigeonCount', $pigeonList['cant'] ); $gBitSmarty->assign( 'numPages', ceil( $pigeonList['cant'] / $gBitSystem->mPrefs['maxRecords'] ) ); |
