I have the following code in my home_controller:
<?php
class HomeController extends AppController
{
var $name = 'Home';
var $uses = array();
function index ()
{
$this->set('title_for_l开发者_运维知识库ayout', 'Welcome to CreatHive');
}
}
?>
Unlike normal authentication whereby you would redirect the user to a login form if they try and access certain actions or controllers I just want to show a different view for my index method on my homecontroller. So if the user is NOT logged in then show splash.ctp
and if they are logged in then show index.ctp
Thanks
public function index() {
$this->set('title_for_layout', 'Welcome to CreatHive');
if (!$this->Auth->user()) {
$this->render('splash');
}
}
精彩评论