Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework] Wyświetlanie widoku, An error occurred Application error
PiotrekM
post
Post #1





Grupa: Zarejestrowani
Postów: 130
Pomógł: 6
Dołączył: 20.12.2009

Ostrzeżenie: (0%)
-----


Witam,
dopiero zaczynam z Zendem i mam, zdaje się bardzo laicki problem.
Podczas gdy próbuje wyświetlić jakiś widok, to otrzymuję błędy
Kod
An error occurred
Application error


IndexController.php
  1. <?php
  2. class IndexController extends Zend_Controller_Action
  3. {
  4. function indexAction()
  5. {
  6. $data = array(
  7. 'author' => 'Hernando de Soto',
  8. 'title' => 'The Mystery of Capitalism'
  9. ),
  10. 'author' => 'Henry Hazlitt',
  11. 'title' => 'Economics in One Lesson'
  12. ),
  13. 'author' => 'Milton Friedman',
  14. 'title' => 'Free to Choose'
  15. )
  16. );
  17.  
  18. // now assign the book data to a Zend_View instance
  19. Zend_Loader::loadClass('Zend_View');
  20. $view = new Zend_View();
  21. $view->books = $data;
  22.  
  23. // and render a view script called "booklist.php"
  24. echo $view->render('booklist.php');
  25. }
  26.  
  27. }


./application/views/booklist.php
  1. <?PHP if ($this->books): ?>
  2.  
  3. <!-- A table of some books. -->
  4. <table>
  5. <tr>
  6. <th>Author</th>
  7. <th>Title</th>
  8. </tr>
  9.  
  10. <?php foreach ($this->books as $key => $val): ?>
  11. <tr>
  12. <td><?php echo $this->escape($val['author']) ?></td>
  13. <td><?php echo $this->escape($val['title']) ?></td>
  14. </tr>
  15. <?php endforeach; ?>
  16.  
  17. </table>
  18.  
  19. <?php else: ?>
  20.  
  21. <p>There are no books to display.</p>
  22.  
  23. <?php endif;?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.09.2025 - 15:32