Welcome Guest, Not a member yet? Register   Sign In
CI Sessions - No user data
#31

[eluser]toopay[/eluser]
Ok, so NOW you set session lib in autoload right? But i dont see, you try to gathering Session user data in 'View' controller (by the way, your naming convention is lil bit weird. I will not give some controller name with something like "View")
#32

[eluser]robjstanley[/eluser]
the view controller serves as the main controller.

so my sites main pages are loaded from that, index is the home page and other functions such as about, contact etc work fine with the session, only index doesnt.
#33

[eluser]toopay[/eluser]
Unbelievable. You sure that your environment is okay. What if you create some function, lets say something like "home" for your homepage, instead using View's index function.
#34

[eluser]robjstanley[/eluser]
I did create a home function, which works perfectly when you go to www.site.com/view/home

but then if you go to www.site.com obviously there is no index page. and i tried to redirect the user to /view/home but then the problem returns as the index function has to be used in order to redirect the user.
#35

[eluser]toopay[/eluser]
What if you define some variable, lets say something like $user_detail at construct, and use it to save the session userdata, so that it available in every function at View controller (fiuh, this naming convention give me some headache already Tongue). Is it working?
#36

[eluser]InsiteFX[/eluser]
You have to have an index function in your controllers that is the default that CI calls when you go to that controller!

InsiteFX
#37

[eluser]robjstanley[/eluser]
How would i do that?

also, what naming convention would you suggest.
#38

[eluser]robjstanley[/eluser]
[quote author="InsiteFX" date="1301437470"]You have to have an index function in your controllers that is the default that CI calls when you go to that controller!

InsiteFX[/quote]

Yes i understand the logic, i dont understand why the index function is the only one which doesnt recognise the session.
#39

[eluser]InsiteFX[/eluser]
Or use a MY_Controller and extend all your other controllers from the MY_Controller

InsiteFX
#40

[eluser]InsiteFX[/eluser]
Because you must not be setting up your session data in the main controller.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB