Hi
I have just started using fuelphp
but i have a problem where Response::redirect dosent work. It gives me an error that the page cant be shown.
The index class that is running
<?php
class Controller_Index extends Controller_Admin
{
public function action_index()
{
return View::forge('index/index', $data);
}
public function action_login()
{
return View::forge('admin/login');
}
}
?>
Class nr 2 running
<?php
abstract class Controller_Admin extends Controller_Template
{
public $template = 'index/index';
public function before()
{
parent::before();
if ( ! Auth::member(100))
{
Response::redirect('index/login');
}
}
}
?>
If you type the URL in directly ( "http://yoursite/index/login" ), does that work?
If so, what does it redirect to? The redirect URL is constructed based on the parameter and your configuration (your base_url, include index.php or not, etc). Also having a setup where /public isn't your docroot might have an impact, as your rewrite rules should be adapted.
it works if i dont extend admin. But i changed the response redirect to refresh and it was a endless loop of redirects, so iam going to look in to that. Tanks for a fast reponse.
The magic lays her:
public function before()
{
parent::before();
if (Request::active()->action != 'login')
{
Response::redirect('admin/login');
}
}
I forgot to check if the action was login.