![]() |
Accessing controller variables in the viewer - 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: Accessing controller variables in the viewer (/showthread.php?tid=2715) |
Accessing controller variables in the viewer - El Forum - 08-21-2007 [eluser]dedavai[/eluser] I'm having trouble accessing variables created inside the controller from within the viewer. For example, inside the controller (home.php) I have the following: Code: function view() { Code: <input type="text" name="cp" value="<?=($sub ? "CP value" : "");?>"> Accessing controller variables in the viewer - El Forum - 08-21-2007 [eluser]Michael Wales[/eluser] Variables must be passed within an array to the view from the controller. Controller: Code: function view() { View: Code: <input type="text" name="cp" value="<?= $sub ? "CP Value" : ""); ?>"> Please read the View documentation and the Loader documentation. |