Using a same view page in different controller. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Using a same view page in different controller. (/showthread.php?tid=67575) |
Using a same view page in different controller. - arisroyo - 03-11-2017 Question Guys! I have home_view.php view page and calling it by default like $this->load->view('home_view'); In my home controller It's my default index page and it's working fine. http://localhost/CIProject/ class Home extends CI_Controller { public function index() { $this->load->view('home_view'); } Now after user registration I'm want to display the same view page after validate user but off course it's already different URL. http://localhost/CIProject/login/validateUser class Login extends CI_Controller { public function validateUser() { $this->load->view('home_view'); } But I'm getting the following error notice: File: /home/aris/public_html/CIProject/application/controllers/Login.php Line: 12 Function: _error_handler File: /home/aris/public_html/CIProject/index.php Line: 315 Function: require_once RE: Using a same view page in different controller. - PaulD - 03-11-2017 There is no problem calling the same view in different controllers. Normally after a successful login you would show either a success page or redirect to the home page controller. The error you are getting does not seem to be view related. RE: Using a same view page in different controller. - Wouter60 - 03-11-2017 In CI 3.1.3, index.php line 315 says this: PHP Code: require_once BASEPATH.'core/CodeIgniter.php'; So I think you didn't install CI as it should be. RE: Using a same view page in different controller. - arisroyo - 03-11-2017 Thanks for the respond, I already figure out the my issue. The problem is that I configure some variable during initialization and forgot to put parent::__construct(); function __construct() { //Solution parent::__construct(); $this->load->helper('url'); $this->_init(); } |