CodeIgniter Forums
Dynamic Data Objects - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Dynamic Data Objects (/showthread.php?tid=13003)



Dynamic Data Objects - El Forum - 11-07-2008

[eluser]bastones[/eluser]
Hi,

I have the following piece of code:
Code:
else {
    $activate_now=new Activate();
        $this->load->view('login_view',$activate_now);
}

...and basically inside the view file I want to request the object? Like I would do $activate_now->function for example? Hope I explained enough Smile.

Cheers.


Dynamic Data Objects - El Forum - 11-07-2008

[eluser]Aken[/eluser]
I'm pretty positive you can't pass objects through to view files. Instead, you should create an Activate library, and have it's variables returned as an array instead of an object.

Then in the view, instead of calling $activate_now->variable, you'd call $activate_now['variable']


Dynamic Data Objects - El Forum - 11-07-2008

[eluser]bastones[/eluser]
sorry that doesn't make sense to me, can you elaborate?


Dynamic Data Objects - El Forum - 11-07-2008

[eluser]Aken[/eluser]
Read the User Guide portion about loading dynamic content into your views: http://ellislab.com/codeigniter/user-guide/general/views.html


Dynamic Data Objects - El Forum - 11-07-2008

[eluser]frenzal[/eluser]
I think this would work:
Code:
else {
    $data["activate_now"] =new Activate();
        $this->load->view('login_view',$data);
}

and then your object will be $activate_now