Hello! I have a problem with ->redirect() in my controller.
I've downloaded the cakephp 1.2.5 empty project and created users_controller, here is it: class UsersController extends AppController { var $name = "Users"; function index() { echo 'index'; } function test() { $this->redirect('/users/index', null, true); } } Very simple :) I created corresponding templates for these two actions. But, when I try to load "test" action I get the empty page with "Cannot modify header information - headers already sent by" warning. Here is specific html code: <pre class="cake-debug"> <a href='javascript:void(0);' onclick='document.getElementById ("CakeStackTrace1").style.display = (document.getElementById ("CakeStackTrace1").style.display == "none" ? "" : "none")'><b>Warning</b> (2)</a>: Cannot modify header information - headers already sent by (output started at D:\projects\listik\app \controllers\users_controller.php:71) [<b>CORE\cake\libs\controller \controller.php</b>, line <b>645</b>] </pre> <div id="CakeStackTrace1" class="cake-stack-trace" style="display: none;"><a href='javascript:void(0);' onclick='document.getElementById ("CakeErrorCode1").style.display = (document.getElementById ("CakeErrorCode1").style.display == "none" ? "" : "none")'>Code</a> | <a href='javascript:void(0);' onclick='document.getElementById ("CakeErrorContext1").style.display = (document.getElementById ("CakeErrorContext1").style.display == "none" ? "" : "none")'>Context</ a><pre id="CakeErrorContext1" class="cake-context" style="display: none;">$status = "Location: http://listik/users/index"</pre><pre>header - [internal], line ?? Controller::header() - CORE\cake\libs\controller\controller.php, line 645 Controller::redirect() - CORE\cake\libs\controller\controller.php, line 626 UsersController::test() - APP\controllers\users_controller.php, line 24 Object::dispatchMethod() - CORE\cake\libs\object.php, line 116 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194 [main] - APP\webroot\index.php, line 88</pre></div> Cake doesn't actually redirect in my case. Spend two hours trying to solve the problem, still no luck :( Any hint will be appreciated!
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en