Welcome Guest, Not a member yet? Register   Sign In
Form Validation only Works When User is Logged In??
#31

[eluser]Tom Schlick[/eluser]
yes i am still having trouble with it. as said before it is getting from controller to controller so today im gonna try to log message it through every line in the template library to see where it losses its value ... ill let you know the results
#32

[eluser]Tom Schlick[/eluser]
i still need help on this asap. this is very very important and i cant figure out why this is happening... if someone could help again that would be great. im sure its just something stupid that i and my team are overlooking. so please please HELP!!!

thank you
tom
#33

[eluser]ontguy[/eluser]
Were you able to isolate the problem any further?
- the flashdata is getting to the controller
- is it getting to a basic view, without smarty?

Outside of the flashdata, the other session data in the smarty variables are available?
#34

[eluser]Tom Schlick[/eluser]
i can pass data such as userID (which i set) and can retrive it and set it with smarty tags without a problem. i did an initial test to see if it will pass data to a normal page without smarty and i had no luck.

here is the code i tried:
controller code:
Code:
<?php

class Blog extends Controller
{

    function Blog()
    {
        parent::Controller();
            //Load the language file
             $this->lang->load('blog', $this->config->item('language_code'));    
        if(!$this->user_library->isLoggedIn())
        {
            redirect('user/login');
            //log_message("debug", "USERNAME: logged in");
        }    
    }
    function test()
    {
        $this->session->set_flashdata('info', "Hello this is information you need to know");
        $this->load->view('test.php');
    }
}
?>
and the view:
Code:
<h1>&lt;?php echo $this->session->userdata('info');?&gt;</h1>

so it seems that it doesnt like to pass the data to any views? but it does get to the controllers and such...
#35

[eluser]ontguy[/eluser]
I don't think the flashdata would work there, it would available on the next server request.

This should work:

Code:
class Test extends Controller
{

    function Test()
    {
        parent::Controller();
        $this->session->set_flashdata('info', "Hello this is information you need to know");
    redirect('blog/test');
    }

}
?&gt;

class Blog extends Controller
{

    function Blog()
    {
        parent::Controller();
            //Load the language file
             $this->lang->load('blog', $this->config->item('language_code'));    
        if(!$this->user_library->isLoggedIn())
        {
            redirect('user/login');
            //log_message("debug", "USERNAME: logged in");
        }    
    }
    function test()
    {

        $this->load->view('test.php');
    }
}
?&gt;

the view (note: flashdata not userdata):
Code:
<h1>&lt;?php echo $this->session->flashdata('item');?&gt;</h1>
#36

[eluser]drewbee[/eluser]
Out of curiosity, I am not sure if this is a mistake or not just from pasting things around, but flash data is suppose to be read using the flashdata() method.

Code:
<h1>&lt;?php echo $this->session->flashdata('info');?&gt;</h1>


EDIT: Sniped ;-)
#37

[eluser]Tom Schlick[/eluser]
ok it does work. i didnt realize in the test i was calling it as userdata instead of flashdata and there was no redirect. so it works without smarty but i dont understand why smarty would be an issue because the other data does pass such as userID and email that we set as session data when a user logs in




Theme © iAndrew 2016 - Forum software by © MyBB