![]() |
How can i echo variable of one view page to another view page ? - 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: How can i echo variable of one view page to another view page ? (/showthread.php?tid=31001) |
How can i echo variable of one view page to another view page ? - El Forum - 06-03-2010 [eluser]dhaulagiri[/eluser] How can i echo variable of one view page to another view page of same controller and different controller ? do i need to use php include ? How can i echo variable of one view page to another view page ? - El Forum - 06-03-2010 [eluser]LuckyFella73[/eluser] It depends what you want to achieve axactly. If your variable never changes you could DEFINE it and use where ever you want. For controller-wide usage you can code somthing like the following in yout controller constructor: Code: $this->my_var = "example value"; and send to the views called by your controller Code: // method 1: How can i echo variable of one view page to another view page ? - El Forum - 06-03-2010 [eluser]rufnex[/eluser] If you have a nested view like that: main.php: Code: <html> nav.php: Code: <?php echo $title; ?> You can route the data vars with somethink like that in your controller: xyz_controller.php: Code: $data['title'] = "My Title"; Anyone has a better idea or solution for that? |