Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Zend Framework] problem z kontrolerem
eS...
post 13.01.2007, 14:27:30
Post #1





Grupa: Zarejestrowani
Postów: 367
Pomógł: 2
Dołączył: 4.03.2003
Skąd: C:/Windows/Temp

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


Witam.
Właśnie zaczołem się bawić frameworkiem Zenda. Niestety ale wszystko idzie do przodu i pasuje wkońcu zainteresować się frameworkami.

A więc. Ściągnołem zenda w wersji chyba 0.6.0. Zrobiłem wszystko wg. tutka ze strony zenda pomagając sobie tutkiem z php.pl. Napisałem coś takiego (jak kazali biggrin.gif )
  1. <?php
  2. error_reporting(E_ALL|E_STRICT);
  3. date_default_timezone_set('Europe/London');
  4. set_include_path('.' . PATH_SEPARATOR . './library'
  5. . PATH_SEPARATOR . './application/models/'
  6. . PATH_SEPARATOR . get_include_path());
  7. include "Zend.php";
  8. Zend::loadClass('Zend_Controller_Front');
  9. // setup controller
  10. $baseUrl = '/zend';
  11. $frontController = Zend_Controller_Front::getInstance();
  12. $frontController->setBaseUrl($baseUrl);
  13. $frontController->setControllerDirectory('./application/controllers');
  14. $frontController->throwExceptions(true);
  15. // run!
  16. $frontController->dispatch();
  17. ?>

  1. <?php
  2. class IndexController extends Zend_Controller_Action
  3. {
  4. function indexAction()
  5. {
  6. echo "<p>in IndexController::indexAction()</p>";
  7. }
  8.  
  9. function addAction()
  10. {
  11. echo "<p>in IndexController::addAction()</p>";
  12. }
  13.  
  14. function editAction()
  15. {
  16. echo "<p>in IndexController::editAction()</p>";
  17. }
  18.  
  19. function deleteAction()
  20. {
  21. echo "<p>in IndexController::deleteAction()</p>";
  22. }
  23. }
  24. ?>

I teraz odpalam stronke, i elegancko wyświetla mi "in IndexController::indexAction()"
Niestety już przy prubie odpalenia addAction (czyli http://localhost/zend/add) wyskakuje ten błąd:
Cytat
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message '"add" controller does not exist' in C:\Program Files\apache\htdocs\zend\library\Zend.php:229 Stack trace: #0 C:\Program Files\apache\htdocs\zend\library\Zend\Controller\Dispatcher.php(386): Zend::exception('Zend_Controller...', '"add" controlle...') #1 C:\Program Files\apache\htdocs\zend\library\Zend\Controller\Front.php(725): Zend_Controller_Dispatcher->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #2 C:\Program Files\apache\htdocs\zend\index.php(16): Zend_Controller_Front->dispatch() #3 {main} thrown in C:\Program Files\apache\htdocs\zend\library\Zend.php on line 229

Wiem że jest w tutoriali Troubleschooing
Ale kompletnie nie pomaga.
Jeżeli ktoś może to prosto wytłumaczyć to będe wdzięczny.

p.s
Nie wiem czy to ważne ale zamieszcczam jeszcze to co mam w .htaccess
Cytat
RewriteEngine on
RewriteRule .* index.php
php_flag magic_quotes_gpc off
php_flag register_globals off

p.s 1 wszystkie pozostałe warunki zostały spełnione, więc proszę nie pisać pytań czy mam php w wersji 5, jedyne co może stanowić problem to mod_rewrite


EDIT
Cóż smile.gif
Działa ale nie http://localhost/zend/add ale http://localhost/zend/index/add
Nigdy wiecej czytania o 5 rano smile.gif

Ten post edytował eS... 13.01.2007, 18:44:09


--------------------
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 27.04.2024 - 13:55