class Controller_Admin extends Controller_Base {
public $template = 'admin/template';
public function before()
{
parent::before();
if ( ! Auth::member(100) and Request::active()->action != 'login')
{
Response::redirect('admin/login');
}
}
class Controller_Site extends Controller_Template
{
public $template = 'template_main';
public function before()
{
parent::before();
if ($this->IsMobileUserAgent())
{
$this->template = 'template_mobile';
}
}
public function action_index()
{
$this->template->title = 'The title';
$view = View::forge('site/index');
$this->template->content = $view;
}
// The code to detect a user agent is large - this is just a stub as an example
private function IsMobileUserAgent()
{
// If it's a mobile browser, return true
// else return false - code from [url=http://detectmobilebrowsers.com/]http://detectmobilebrowsers.com/[/url]
return true;
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!