By tpainton on
This is driving me bonkers. I thought I understood this. I am pulling nodes out of the database, then simply comparing a field, if true, then add to an array, then return the array as multiple arguments to exlude from a view..
if ( $collab_note_nid->field_collab_note_nursing[0]['nid'] == $my_nurse_nid){
array_push($time_block_array, $collab_note_nid->field_collab_note_time[0]['nid']);
}
$time_block_array = array_unique($time_block_array);
return implode('+', $time_block_array);
My array return is the problem. It is coming in as
+453+467
I need 453+467. I must be adding a null value to the array. Is there a simple way to strip that out, or a better way to return the nids as 453+467?
Thanks a ton. Worked all day on this.
Comments
assuming your array is blank
assuming your array is blank before you start ... try a lazy trick ..
get rid of the array_push call ... replace it with ...
$time_block_array[$collab_note_nid->field_collab_note_time[0]['nid']]=true;
then ...
return implode('+', array_keys($time_block_array));
(you won't need the array_unique call either).
Oh, that is crafty. Very
Oh, that is crafty. Very nice, thanks.