gallery model and image model has blinded..but when i retrive images
from galleries_controller i cant see any result..and see this error
Warning (2): Invalid argument supplied for foreach() [APP\views
\galleries\view.ctp, line 35]

  function view($id = null) {
            if (!$id) {
                $this->Session->setFlash(__('Invalid gallery', true));
                $this->redirect(array('action' => 'index'));
            }
            $this->set('gallery', $this->Gallery->read(null,$id));
 $this->Gallery->Image->find('all',array('conditions' =>
array('Image.gallery_id'=> $id)));
             $this->set('images', $images);

        }

in the gallreies/view ip put this loop

<?php

        $i = 0;
        foreach ($images['Image'] as $image):
            $class = null;
            if ($i++ % 2 == 0) {
                $class = ' class="altrow"';
            }
        ?>
        <tr<?php echo $class;?>>
            <td><?php $image['id'] ;?></td>
            <td><?php echo $image['name'];?></td>
            <!--<td><?php echo $image['img_file'];?></td>-->

            <td><?php  echo $html->image('uploads' . DS . 'images' .
DS . $image['img_file'], array('alt' => 'Gallery Image')); ?></td>

        </tr>
    <?php endforeach; ?>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to