can you load a view within a view - 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: can you load a view within a view (/showthread.php?tid=53444) |
can you load a view within a view - El Forum - 07-24-2012 [eluser]bill19[/eluser] Hello, I have an html form which I have saved in a view called page1.php . I have a form ( an html fragment ) in the view form.php. Is there a way to insert form.php into page.php, and have it be presented as valid html? Thanks, Bill can you load a view within a view - El Forum - 07-24-2012 [eluser]TWP Marketing[/eluser] Yes. but it is better to do this in your controller, using the second parameter of the loader function for example, in the controller Code: ... Notice the second parameter in the first three calls to load->view(). In the view named page.php: Code: ... can you load a view within a view - El Forum - 07-24-2012 [eluser]PhilTem[/eluser] You can, but actually should not, have this code in your page.php Code: // ... All your previous code can you load a view within a view - El Forum - 07-24-2012 [eluser]skunkbad[/eluser] [quote author="PhilTem" date="1343154126"]You can, but actually should not, have this code in your page.php Code: // ... All your previous code I think you should be clear who you are replying to, what you should not do, and why you should not do it. |