Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework]Własny kontroler
Ikky
post
Post #1





Grupa: Zarejestrowani
Postów: 120
Pomógł: 1
Dołączył: 5.07.2009

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


Witam od jakiegoś czasu usiłuje zrobić swój własny kontroler który dziedziczył by po zend_controller_action.

Więc tak chce powiedzmy zrobić tak żeby w każdym kontrolerze miał napis test

1) stworzyłem w library/App/Controller/Test.php

  1. <?php
  2. class App_Controller_Test extends Zend_Controller_Action
  3. {
  4.  
  5. public function init()
  6. {
  7. echo "test";
  8. }
  9. }


no i teraz sobie w IndexControllerze zamieniam

Zend_Controller_Action na:

  1. <?php
  2. class IndexController extends App_Controller_Test
  3. {


Wyskakuje mi taki błąd

Fatal error: Class 'App_Controller_Test' not found in /home/users/test/www/application/controllers/IndexController.php on line 2

Co robie źle?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Elbacer
post
Post #2





Grupa: Zarejestrowani
Postów: 21
Pomógł: 1
Dołączył: 25.12.2008

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


w pliku INI:
  1. autoloadernamespaces.0 = "My_"

i kontroler w: "\library\My\Controller\Action.php"

  1. <?
  2.  
  3. abstract class My_Controller_Action extends Zend_Controller_Action {
  4.  
  5. public function init() {
  6. }
  7.  
  8. }
  9.  
  10. ?>
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: 26.12.2025 - 01:46