Ok ill post a bigger part of the code hope it make it more clear.
A while ago i wrote this code for a music database, it scans the ID3 tags from mp3's on a cd. This code is from a page were a list of all the albums from every band in the db are created.
while ( list( $sBand ) = each( $oList )) {
$iBand = $PHP['oClasses']['oTemplate']->addBlock( array(
'TPL_BAND' => array(
'TPL_BAND' => $sBand
)
));
if ( isset( $oList[ $sBand ]['oCD'] )) {
while ( list( $iID, $sCD ) = each( $oList[ $sBand ]['oCD'] )) {
$iCD = $PHP['oClasses']['oTemplate']->addBlock( array(
'TPL_CD' => array(
'TPL_BAND' => $sBand
)
), $iBand );
unset( $iID );
unset( $sCD );
}
}
unset( $sBand );
}
$oList is an array which looks like this:
$oList[ bandname ] = array(
[ cd-id ] => cd-name
)
And now the troublemaker, addBlock is part of large template class. These are the first lines which generate errors:
function addBlock( $oBlock, $iID='') {
if ( !is_array( $oBlock )) {
trigger_error("Template->addBlock : The argument given must be an array not a(n) " . gettype( $oBlock ), E_USER_WARNING );
}
list( $sBlockName ) = each( $oBlock );
And this is the error generated by the code above:
Warning: Template->addBlock : The argument given must be an array not a(n) NULL in D:\Web\Online\music_module\template.php on line 75
Warning: Variable passed to each() is not an array or object in D:\Web\Online\music_module\template.php on line 78