I'm having trouble writing my array values to my view. In the past, I've used objects and $this->view->[object] = $object->fetchAll(), and in my view I've just had to do a foreach($this->object as obj), and echo out the values of the object. I've also only had to deal with an array value with one rowset in it, so I've just had to echo out the values in the array. Now I'm trying to send an array with multiple rows to the view, and it's just printing out the last value of the array equal to the size of the array. Is there a way to do this similar to the object method? For example:
(in my controller, IndexAction)
$this->view->houses = $houses->fetchAll();
(in my index.phtml file, or view)
<?php foreach($this->houses as $house) : ?>
<tr>
<td><?php echo $this->escape($house->types);?></td>
<td><?php echo $this->escape($house->ownership);?></td>
<td><?php echo $this->escape($house->income);?></td>
<td><?php echo $this->escape($house->members);?></td>
</tr>
Any suggestions would be very helpful.
Thomas
没有评论:
发表评论