Hey there. I keep getting this error:

warning: Invalid argument supplied for foreach() in /home/17296/domains/distefanolandscaping.com/html/drupal/sites/all/themes/dl_v2/page.tpl.php on line 35.

Line 35 is the first line of this block of PHP:

foreach ($node->files as $file) {
    $fileType = $file->filemime;
    if($fileType == 'image/jpeg') {
        $imagePath = $file->filepath;
        $imageTitle = $file->description;                         
        print '<li><img src="'.base_path().'/'.$imagePath.'" alt="" title="'.$imageTitle.'" /></li>';
    }
}    

What's strange is that the list of attached images is being created, and displaying just as I would expect it to, but I am still getting this message. Anyone have any ideas?

Could it be because it is in the page template, and the "node" in "$node->files" is not explicitly specified?