Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Code Igniter] problem
Forum PHP.pl > Forum > PHP > Frameworki
trt
Od niedawna korzystam z frameworka Code Igniter. Napisałem prosty system służący do dodawania newsów na stronie. Mój problem polega na tyym że na localhoście wszystko chodzi bez zarzutów, ale jak zgrałem strone na serwer to przy próbie wejścia na stronę wyskakuje mi taki błąd:
Cytat
Fatal error: ob_start() [<a href='ref.outcontrol'>ref.outcontrol</a>]: Cannot use output buffering in output buffering display handlers in /var/www/sites/yoyo.pl/t/r/trt-home/system/libraries/Exceptions.php on line 160


Może to wina serwera?
Bardzo proszę o pomoc.
Fipaj
Pokaż swój sterownik.
Czy użyłeś jakiejś funkcji ob_*()? Jeśli tak, wyrzuć ją! Korzystaj z obiektu $this -> output, który jest domyślnie ładowany do sterownika.

Anyway, ten błąd wyleciał chyba podczas wywoływania kodu wyjątku, tak więc chyba nie tylko to wyszło źle. winksmiley.jpg Czy jeśli na localhoscie wpisywałeś adres: index.php/kontrolerktoregoniema, to wyświetlało się coś takiego czy poprawny błąd?
trt
Na localhoście przy wywyołaniu błędnego kontrolera wszystko jest ok tzn wyrzuca wyjątek 'page not found'.
Masz rację dzieje się to przy wyrzuceniu wyjątku bo wiem że coś poszło nie tak, ale nie wiem co bo nie mogę tego odczytać. Nie korzystam z żadnej funkcji ob_.
to mój domyslny kontroler:
  1. <?php
  2. class Page extends Controller
  3. {
  4. public function __construct()
  5. {
  6. parent::Controller();
  7. $this->response = array();
  8. }
  9. public public function index()
  10. {
  11. $page_id = 1;
  12. // przekazanie danych do szablonu
  13. $this->response['main_menu_content'] = '';#$this->_addMainMenu();
  14. $this->response['submenu_content'] = '';#$this->_addSubmenus($page_id);
  15. $this->response['right_submenu'] = '';#$this->_addSpecialPost();
  16. $this->response['main'] = '';#$this->_addPosts($page_id);
  17.  
  18. $this->load->view('test', $this->response);
  19. }
  20.  
  21. public function content($page_id,$post_id=null)
  22. {
  23. // przekazanie danych do szablonu
  24. $this->response['main_menu_content'] = $this->_addMainMenu();
  25. $this->response['submenu_content'] = $this->_addSubmenus($page_id);
  26. $this->response['right_submenu'] = $this->_addSpecialPost();
  27. if($post_id === null)
  28. $this->response['main'] = $this->_addPosts($page_id);
  29. else $this->response['main'] = $this->_addPost($post_id);
  30.  
  31.  
  32. $this->load->view('test', $this->response);
  33. }
  34.  
  35. private function _addMainMenu()
  36. {
  37. $this->load->model('main_menu');
  38. $query = $this->main_menu->get_main_menu();
  39. $content = '';
  40. // czy są jakieś wiersze?
  41. if ($query->num_rows() > 0)
  42. {
  43. foreach($query->result() as $item)
  44. {
  45. $content .= $this->load->view('main_menu', $item, True);
  46. }
  47. }
  48. return $content;
  49. }
  50.  
  51. private function _addSubmenus($page_id)
  52. {
  53. $this->load->model('submenu');
  54. $this->load->model('post');
  55. $query = $this->submenu->get_page_submenu($page_id);
  56. $content ='';
  57. if ($query->num_rows() > 0)
  58. {
  59. foreach($query->result() as $item)
  60. {
  61. $content .= $this->load->view('submenu_nazwa', $item, True);
  62. $query_poz = $this->post->get_post_by_submenu($item->id);
  63. if($query_poz->num_rows() > 0)
  64. {
  65. $content .= '<ul>';
  66. foreach($query_poz->result() as $sub_item)
  67. {
  68. $content .= $this->load->view('submenu_poz', $sub_item, True);
  69. }
  70. $content .= '</ul>';
  71. }
  72. }
  73. }
  74. return $content;
  75. }
  76.  
  77. private function _addPost($post_id)
  78. {
  79. $this->load->model('post');
  80. $query = $this->post->get_post($post_id);
  81. $content = '';
  82.  
  83. if ($query->num_rows() > 0)
  84. {
  85. foreach($query->result() as $item)
  86. {
  87. $content .= $this->load->view('full_post', $item, True);
  88. }
  89. }
  90. return $content;
  91. }
  92.  
  93. private function _addPosts($page_id)
  94. {
  95. $this->load->model('post');
  96. $this->load->model('main_menu');
  97. $query = $this->post->get_posts_by_pageid($page_id);
  98. $main_menu_query = $this->main_menu->get_main_menu_by_mmid($page_id);
  99. $content = '';
  100. foreach($main_menu_query->result() as $mm_item)
  101. $content = $this->load->view('page_title', $mm_item, True);
  102.  
  103. if ($query->num_rows() > 0)
  104. {
  105. foreach($query->result() as $item)
  106. {
  107. $content .= $this->load->view('main', $item, True);
  108. }
  109. }
  110. return $content;
  111. }
  112.  
  113. private function _addSpecialPost()
  114. {
  115. $this->load->model('post');
  116. $query = $this->post->get_special_post();
  117. $content = '';
  118. if ($query->num_rows() > 0)
  119. {
  120. foreach($query->result() as $item)
  121. $content = $this->load->view('high_post', $item, True);
  122. }
  123. return $content;
  124. }
  125.  
  126. private function _addArchive($page_id)
  127. {
  128. $this->load->model('main_menu');
  129. $query = $this->main_menu->get_main_menu();
  130. $content = '';
  131. if ($query->num_rows() > 0)
  132. {
  133. foreach($query->result() as $item)
  134. {
  135. $content .= $this->load->view('main_menu', $item, True);
  136. }
  137. }
  138. return $content;
  139. }
  140. ?>

Zmieniłem już rozszerzenia wszystkich plików na php5 i znów to samo: na localhoście chodzi a na serwerze już nie (wyrzuca ten sam błąd). Przenoszę się na cba.pl
nrm
Cytat(trt @ 16.03.2007, 13:13:54 ) *
Zmieniłem już rozszerzenia wszystkich plików na php5 i znów to samo:

Tylko po co skoro odpalasz wszystko poprzez index?
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.