Now we need the associated view script, "booklist.php".
This is a PHP script like any other, with one exception: it
executes inside the scope of the Zend_View instance, which
means that references to $this point to the Zend_View
instance properties and methods. (Variables assigned to the
instance by the controller are public properties of the
Zend_View instance). Thus, a very basic view script could
look like this:
if ($this->books): ?>
<!-- A table of some books. -->
<table>
<tr>
<th>Author</th>
<th>Title</th>
</tr>
<?php foreach ($this->books as $key => $val): ?>
<tr>
<td><?php echo $this->escape($val['author']) ?></td>
<td><?php echo $this->escape($val['title']) ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php else: ?>
<p>There are no books to display.</p>
<?php endif;?>
Note how we use the "escape()" method to apply output escaping to variables.




