![]() |
Views within Views - 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: Views within Views (/showthread.php?tid=5718) |
Views within Views - El Forum - 02-01-2008 [eluser]kevinprince[/eluser] Im stuck and have been for a hour or so, im building a newsletter generator, which outputs in a text box. If i do $var = $this->load->view('newsletter', $data); It loads the view, and doesnt seem to keep it in PHP, for the actual view call. Any Ideas? Kevin Views within Views - El Forum - 02-01-2008 [eluser]Tom Glover[/eluser] This is how I create a similar function. Template file Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> The left view file: (Simple Login) Code: <?php The Right Content: Code: <h2>Welcome to O<em>PM</em>S</h2> and finally the controller that brings it all together: Code: class Welcome extends Controller { EDIT: By the way all you needed to add in the $var is True to return the file as a string not and output, this will then allow you to output it by echoing the $var where you need it. this is shown in the example above. Views within Views - El Forum - 02-01-2008 [eluser]sophistry[/eluser] the faq will be your guide Views within Views - El Forum - 02-01-2008 [eluser]kevinprince[/eluser] So so stupid of me! Thanks |