CodeIgniter Forums
How can I include or Call Session Controller In to My home page ,about page .... - 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: How can I include or Call Session Controller In to My home page ,about page .... (/showthread.php?tid=61711)



How can I include or Call Session Controller In to My home page ,about page .... - Chandini - 05-08-2015

How  Can I Include or call the my session controller file .. in to my home page .. due to session check .... ?

in php : include(session_check.php);

in CI   :.......?  


RE: How can I include or Call Session Controller In to My home page ,about page .... - noobie - 05-08-2015

(05-08-2015, 02:38 AM)Chandini Wrote: How  Can I Include or call the my session controller file .. in to my home page .. due to session check .... ?

in php : include(session_check.php);

in CI   :.......?  

I think you are confusing Controllers, Models and Libraries (in your attached images, you write a model in a controller then load it as a `Library`!)

I suggest you read the User Guide first:
http://www.codeigniter.com/user_guide/


RE: How can I include or Call Session Controller In to My home page ,about page .... - Urastor - 05-08-2015

If you want to write you session check as a library, you need to put your Session_check file into the library folder:

app
----library
--------Session_check.php

You can load it via $this->load->library('Session_check'); , if the file is called Session_check.php.

But you can't simply extends CI_Controller, you need to get an instance of CI, via get_instance();

Have a look here, if you don't know how to get CI instance. Wink
http://forum.codeigniter.com/thread-61626.html

And for the purpose of learning, look here http://www.codeigniter.com/userguide3/general/creating_libraries.html

But for simpleness, just write the Content of Session_check in the same controller or write it in a MY_Controller and extend it, instead of CI_Controller. But this is just a mention. Tongue