select all of the cubes then Group them (ctrl g). Select the group (Just selet one of the cubes then hit the Arrow Up key) That will highlight the group. then assign the phong shader.