Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZF] błąd na stronie - controller się wykonule ale wywala błąd
krzyszbi
post
Post #1





Grupa: Zarejestrowani
Postów: 251
Pomógł: 13
Dołączył: 15.09.2005

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


wietam
jako ze juz teoretycznie mamy wersje 1.0 choć co prawda jeszcze nie stabilna ale już coś więc pisze bo natrafiłem na jak dla mnie dziwny problem i nie mogę sobie z nim poradzić
a mianowicie mam plik bootstrap taki
  1. <?php
  2. function getmicrotime() { list($usec, $sec) = explode(' ',microtime()); return ((float)$usec + (float)$sec); }
  3. $time_start = getmicrotime();
  4. ini_set ('include_path', './lib/');
  5. define('LOCATION', 'http://localhost/');
  6. require_once './lib/Zend/Loader.php';
  7. Zend_Loader::loadClass('Zend_Controller_Front');
  8. Zend_Loader::loadClass('Zend_Db');
  9. Zend_Loader::loadClass('Zend_Registry');
  10. Zend_Loader::loadClass('Zend_Session');
  11. Zend_Loader::loadClass('Zend_Auth');
  12. Zend_Session::start();
  13. define('OPT_DIR', './lib/others/opt/');
  14. require(OPT_DIR.'opt.class.php');
  15. Zend_Registry::set('db', Zend_Db::factory('PDO_Mysql', array ('host'=>'localhost','username'=>'user','password'=>'*****','dbname'=>'baza')));
  16. Zend_Registry::set('tpl', new optClass);
  17. Zend_Loader::loadClass('Zend_Cache');
  18. Zend_Registry::set('cache', Zend_Cache::factory('Core', 'File',array('lifeTime' => 86400,'automaticSerialization' => true), array('cacheDir' => './cache/')));
  19. $controller = Zend_Controller_Front::getInstance();
  20. $controller -> throwExceptions(true);
  21. $controller -> run(
  22. 'default'  => './app/default/controllers/',
  23. 'admin'  => './app/admin/controllers',
  24. 'Admin'  => './app/admin/controllers'
  25. ));
  26. $time_end = getmicrotime();
  27. $time = round($time_end - $time_start, 4);
  28. echo '<!--Skrypt wykonany w czasie: '.$time.' sekundy-->';
  29. ?>

taki sam pliki pod ZF 0.93B ładnie działa i nic nie wyrzuca
indexcontroller
  1. <?php
  2. class IndexController extends Zend_Controller_Action{
  3. private $db;
  4. private $tpl;
  5. public function init(){
  6. $this -> db = Zend_Registry::get('db');
  7. $this -> tpl = Zend_Registry::get('tpl');
  8. $this -> tpl -> root = './templates/templates/';
  9. $this -> tpl -> compile = './templates/templates_c/';
  10. $this -> tpl -> assign('location', LOCATION);
  11. }
  12. public function indexAction(){
  13. $this->start();
  14. }
  15. private function Start(){
  16. $auth = Zend_Auth::getInstance();
  17. //echo'<pre>'.print_r($auth->getIdentity(),1).'</pre>';
  18. $this -> tpl -> assign('user', $auth->getIdentity() -> username);
  19. $this -> tpl -> parse('index.tpl');
  20. }
  21. public function noRouteAction(){
  22. $this->_redirect('/');
  23. }
  24. private function assign($data, $tamplate,$patch){
  25. $this -> tpl -> root = './templates/templates/'.$patch;
  26. $this -> tpl -> compile = './templates/templates_c/'.$patch;
  27. $this -> tpl -> trace = 1;
  28. foreach($data as $key=>$val){
  29. $this -> tpl -> assign($key, (!empty($val) ? $val : 'NULL'));
  30. }
  31. $this -> tpl -> assign('location', LOCATION);
  32. return $this -> tpl -> fetch($tamplate);
  33. }
  34. }
  35. ?>

no i teraz nie wiem czemu pod pokazaną stroną mam wyrzucony wyjątek ( $controller -> throwExceptions(true); ) o takiej treści
Kod
Fatal error: Uncaught exception 'Zend_View_Exception' with message 'script 'index/index.phtml' not found in path' in D:\serwer\www\lib\Zend\View\Abstract.php:853 Stack trace: #0 D:\serwer\www\lib\Zend\View\Abstract.php(764): Zend_View_Abstract->_script('index/index.pht...') #1 D:\serwer\www\lib\Zend\Controller\Action\Helper\ViewRenderer.php(702): Zend_View_Abstract->render('index/index.pht...') #2 D:\serwer\www\lib\Zend\Controller\Action\Helper\ViewRenderer.php(723): Zend_Controller_Action_Helper_ViewRenderer->renderScript('index/index.pht...', NULL) #3 D:\serwer\www\lib\Zend\Controller\Action\Helper\ViewRenderer.php(770): Zend_Controller_Action_Helper_ViewRenderer->render() #4 D:\serwer\www\lib\Zend\Controller\Action\HelperBroker.php(160): Zend_Controller_Action_Helper_ViewRenderer->postDispatch() #5 D:\serwer\www\lib\Zend\Controller\Action.php(504): Zend_Controller_Action_HelperBroker->notifyPostDispatch() #6 D:\serwer\www\lib\Zend\Controller\Dispatcher\Standard.php(230): Zend_Con in D:\serwer\www\lib\Zend\View\Abstract.php on line 853

wiem wyjątki sobie wyrzucam ale on o tak się nie powinien pojawić Zend_View nie używam nie podoba mi się wole OPT tak samo z helperami nie ładuje nie używam zadnego bo to jest postawione specjalnie do testów
jeśli będzie throwExceptions(false) to dostaje taki błąd
Kod
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in D:\serwer\www\lib\Zend\Controller\Dispatcher\Standard.php:189 Stack trace: #0 D:\serwer\www\lib\Zend\Controller\Front.php(889): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 D:\serwer\www\lib\Zend\Controller\Front.php(229): Zend_Controller_Front->dispatch() #2 D:\serwer\www\index.php(27): Zend_Controller_Front::run(Array) #3 {main} thrown in D:\serwer\www\lib\Zend\Controller\Dispatcher\Standard.php on line 189

choć strona się wygeneruje to ja i tak pod spodem dostaje jak nie jested to drugi komunikat i juz nie wiem poprostu zgłupiałem szukałem dziś cały dzień co jest ale się nie doszukałem (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)
może ktoś już doszedł co jest nie tak tutaj (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
jesli tak to bedzie wdzięczny za podzielenie sie rozwiązaniem sugestią co robie źle
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: 24.08.2025 - 14:40