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

[eluser]robjstanley[/eluser]
Can you be a bit more descriptive? i have no idea what you're talking about.
#42

[eluser]toopay[/eluser]
@InsiteFX, i'm not suggested him to deleting index function, just to swap it with another function for 'homepage' section. Of course, in CI spec, there must be an index in every controller.
#43

[eluser]robjstanley[/eluser]
i added an echo to the construct to display the session data and it only echo's from pages other than index
#44

[eluser]toopay[/eluser]
@robjstanley... You should give some more intuitive name. Lets say, if you are about create a controller that will be your main controller, why dont use something like "base" or "main" instead "view".

And what the result for defining a variable in consctruct of View class, to see what inside Session userdata, and make it available to any functiom below it. Is it working?
#45

[eluser]InsiteFX[/eluser]
Then extend all your other controllers from MY_Controller
Code:
class MY_Controller extends Controller
{
    function MY_Controller()
    {
        parent::Controller();
        $this->load->library('auth');
    }

    function login()
    {
        $this->auth->login();
    }

    function logout()
    {
        $this->auth->logout();
    }

    function register()
    {
        $this->auth->register();
    }

}

InsiteFX
#46

[eluser]robjstanley[/eluser]
No it only works for pages that are not index.

I called it view because i wanted the url to make sense. I figured /view/about/ etc would make more sense to the user than /main/about/
#47

[eluser]InsiteFX[/eluser]
I think his problem is that hes extending Login as Controller and View as Controller when he should be extending them both from a MY_Controller!

InsiteFX
#48

[eluser]toopay[/eluser]
actually, you could even get better result, such as www.site.com/home for homepage, www.site.com/about for about page, with setting up some route like this :
Code:
$route['home'] = 'view/home';
$route['about'] = 'view/about';
// and so on
#49

[eluser]toopay[/eluser]
@InsiteFX,

He doest use some auth module or something sophisticated, like the example structure you gave. He just try to use some controller, as authentification process and use another controller to display page. His only problems, i believed, is the CI session is doesnt work as he expected.
#50

[eluser]InsiteFX[/eluser]
@toopay Thhat was just an example!

I just showed the example because I think he would be better off using a MY_Controller.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB