php - can one controller send the user to another controller -
i new codeigniter.
i trying setup website user must logged in view pages. coming java, taking hierarchical approach things.
my thought write own controller base:
<?php class my_controller extends controller { function controller() { parent::controller(); if(!$this->quickauth->logged_in()) { //they need login, send them login page. } } } ?>
now can write controllers extend , sure logged in.
here outline login page:
<?php class login extends controller { function index() { //lets double check, might not have login. if ($this->quickauth->logged_in()) { //send them main controller } } } ?>
well can see have gotten far. need replace:
1. //send them main controller
2. //they need login, send them login page.
with?
is there better way of doing this?
thanks, blake
redirection easy.
just use:
redirect('controller/method');
yes, load url helper access redirect function.
$this->load->helper('url);
since url helper used lot, should autoload in config/autoload.
Comments
Post a Comment