CodeIgniter Forums
$data in Views not inhereted - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: $data in Views not inhereted (/showthread.php?tid=5742)



$data in Views not inhereted - El Forum - 02-02-2008

[eluser]Lobosaurus[/eluser]
Hi,

I used this pattern in CI 1.54:

- Controller "X" has loaded "View 1" with some $data.
- "View 1" has loaded another view "View 2" with $data from "View 1".
- I accessed $data in View 2 and they were same as in "View 1".

In CI 1.6 it gives me notice, that $data variable is undefined in "View 2".


$data in Views not inhereted - El Forum - 02-02-2008

[eluser]Pascal Kriete[/eluser]
When loading "View 2" within "View 1" you don't have to pass $data again, it will have access to the data array you passed to your top view.