Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> zend framework pierwsze kroki
coolin1986
post 3.03.2008, 21:15:41
Post #1





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 3.03.2008
Skąd: Białoruś

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


Próbuje uruchomić zend framework na localhoscie. Ale coś nie działa... Controllera Korzystam z tego oto samouczka http://blog.heavymind.net/zend-framework-tutorial/  Doszedlem do sprawdzania dzialania controllerów. Controller sie uruchamia, ale funkcje nie. W czym moze być problem?


--------------------
webdesign hamburg
werbung hamburg
GRAND MEDIA
Go to the top of the page
+Quote Post
krupek
post 3.03.2008, 21:22:35
Post #2





Grupa: Zarejestrowani
Postów: 12
Pomógł: 1
Dołączył: 13.07.2007

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


Napisz coś więcej - jakie błędy ci wyrzuca? pokaz kod kontrolera
Go to the top of the page
+Quote Post
coolin1986
post 3.03.2008, 21:31:19
Post #3





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 3.03.2008
Skąd: Białoruś

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


to jest kod controllera:

<?php
echo "test";
class IndexController extends Zend_Controller_Action {
function indexAction() {
echo "<p>in IndexController::indexAction()</p>";
}

function addAction() {
echo "<p>in IndexController::addAction()</p>";
}

function editAction() {
echo "<p>in IndexController::editAction()</p>";
}

function deleteAction() {
echo "<p>in IndexController::deleteAction()</p>";
}
}



Gdy wpisuje http://localhost/projekt/index/  to sie wyswietla "test" a funkcje zawarte w kontrollerze juz nie

Ten post edytował coolin1986 3.03.2008, 21:33:32


--------------------
webdesign hamburg
werbung hamburg
GRAND MEDIA
Go to the top of the page
+Quote Post
krupek
post 3.03.2008, 22:23:10
Post #4





Grupa: Zarejestrowani
Postów: 12
Pomógł: 1
Dołączył: 13.07.2007

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


Wygląda na to , że ten kontroler jest poprawny, problem musi leżeć w innym miejscu. Napisz kod bootstrapera ( index.php ). Czy masz już pliki z widokiem?
Swoją drogą umieszczaj kod php w odpowiednich znacznikach smile.gif
Go to the top of the page
+Quote Post
Sabistik
post 3.03.2008, 22:27:24
Post #5


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

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


Przenoszę i upominam o używanie bbcode.

Sprawdź czy włączyłeś renderowanie wyjątków.
Go to the top of the page
+Quote Post
coolin1986
post 3.03.2008, 22:34:01
Post #6





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 3.03.2008
Skąd: Białoruś

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


To jest bootstrapper

  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.  
  8. include "Zend/Loader.php";
  9. Zend_Loader::loadClass('Zend_Controller_Front');
  10.  
  11. // setup controller
  12. $frontController = Zend_Controller_Front::getInstance();
  13. $frontController->throwExceptions(true);
  14. $frontController->setControllerDirectory('./application/controllers');
  15.  
  16. // run!
  17. $frontController->dispatch();
  18. ?>


Widoki nie są jeszcze włączone, ale i bez nich chyba powinno działać?


--------------------
webdesign hamburg
werbung hamburg
GRAND MEDIA
Go to the top of the page
+Quote Post
Sabistik
post 3.03.2008, 22:37:09
Post #7


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

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


Spróbuj:
  1. <?php
  2. $frontController->returnResponse(true);
  3. $response = $frontController->dispatch();
  4. $response->renderExceptions((bool) true);
  5. ?>
Go to the top of the page
+Quote Post
coolin1986
post 3.03.2008, 22:47:00
Post #8





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 3.03.2008
Skąd: Białoruś

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


Notice: Undefined variable: frontController in...
Fatal error: Call to a member function returnResponse() on a non-object in...

więc też nie działa... może coś w ustawieniach apach'a trzeba zmienić? Mam php 5.2.5 więc powinien obsługiwać zenda...


--------------------
webdesign hamburg
werbung hamburg
GRAND MEDIA
Go to the top of the page
+Quote Post
Sabistik
post 3.03.2008, 23:00:41
Post #9


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

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


Gdzie Ty to wpakowałeś? <<:
Go to the top of the page
+Quote Post
krupek
post 4.03.2008, 14:36:21
Post #10





Grupa: Zarejestrowani
Postów: 12
Pomógł: 1
Dołączył: 13.07.2007

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


Ten kod podany przez Sabistika masz wrzucić do pliku index.php , a nie do kontrolera tongue.gif

  1. <?php
  2. // setup controller
  3. $frontController = Zend_Controller_Front::getInstance();
  4. $frontController->throwExceptions(true);
  5. $frontController->setControllerDirectory('./application/controllers');
  6. $frontController->returnResponse(true);
  7. $response = $frontController->dispatch();
  8. $response->renderExceptions(true);
  9. ?>

O ile dobrze zrozumiałem tak to ma wyglądać

Ten post edytował krupek 4.03.2008, 14:39:01
Go to the top of the page
+Quote Post
coolin1986
post 4.03.2008, 21:02:45
Post #11





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 3.03.2008
Skąd: Białoruś

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


Niestety... żadnego effektu... Macie jakieś gotowe testy na zenda? Najprostrze skrypty do sprawdzenia czy działa

OK! Działa! Wystarczyło dodać widoki, jednak bez nich sie nie da.


--------------------
webdesign hamburg
werbung hamburg
GRAND MEDIA
Go to the top of the page
+Quote Post
krupek
post 4.03.2008, 23:12:22
Post #12





Grupa: Zarejestrowani
Postów: 12
Pomógł: 1
Dołączył: 13.07.2007

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


Cytat(coolin1986 @ 4.03.2008, 21:02:45 ) *
Niestety... żadnego effektu... Macie jakieś gotowe testy na zenda? Najprostrze skrypty do sprawdzenia czy działa

OK! Działa! Wystarczyło dodać widoki, jednak bez nich sie nie da.


Da się, wystarczy we FrontControllerze wyłączyć renderowanie widoku winksmiley.jpg
Go to the top of the page
+Quote Post
roofy_1
post 6.03.2008, 08:08:00
Post #13





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 12.02.2008

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


Witaj!!!
A czy masz odblokowany mod_rewrite w apache??

Pozdr,
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: 24.05.2024 - 16:12