![]() |
Multiple view help - 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: Multiple view help (/showthread.php?tid=13088) |
Multiple view help - El Forum - 11-10-2008 [eluser]Unknown[/eluser] Hi, long time lurker, first time poster. :cheese: I know CI is capable of displaying multiple views called within a controller (according to the user guide - which by the way is excellent), but I have yet to get it to work. If I use the following code taken directly from the user's guide: Code: <?php ...only the last view called gets displayed. In the above code example, I would only get the "footer" view displayed to the browser...none of the views before it gets displayed. Any ideas why? As a work around, I just call the other views from within a parent view. Although, it would be nice to call multiple views from the controller. I've also tried auto-loading a library class which calls separate methods for each view...no luck. Not sure if it matters, but I'm using version 1.5.4 of CI, Apache 2.0 running PHP4 (latest version prior to 5). Thanks in advance for any help! Multiple view help - El Forum - 11-12-2008 [eluser]jwindhorst[/eluser] I use that all the time, and it looks like you are using it properly. Here is the code that is working for me. Code: function index() Try viewing your source to make sure there is not some other syntax error causing things to fail maybe? Anyway, if anyone out there finds a way to automatically load the header first, the whatever I tell it to load, the automatically load the footer, that would be VERY cool! I hate having to call the header and footer in on every method of every controller. Multiple view help - El Forum - 11-12-2008 [eluser]Pascal Kriete[/eluser] @tyzy808, I hesitate to say welcome ![]() @jwindhorst, if you're only loading one view in between - create a simple helper/library. Code: // helper example You can also nest views, so you could create a 'template' view that you load. The possibilities are endless! Multiple view help - El Forum - 11-12-2008 [eluser]jwindhorst[/eluser] Inparo, I hadn't even thought of using a helper for it, so stoopid simple! Of course my favorite answers usually are! Now let's take it to a slight higher level: Code: // helper example This exands the functionality to allow for multiple views each pulling in their own data sets. Thanks for the heads up, I'm think I'm going work on implementing this right now! Multiple view help - El Forum - 11-12-2008 [eluser]Unknown[/eluser] Inparo, thanks for the heads-up on the version issue i had...well, still have since i can't update the version until my current application ends it live run. I suspected thats what it was...but of course was too lazy to read the part of the documentation on version features. DOH! :red: jwindhorst, thanks for the reply. I'm sure Inparo's suggestion will work for you... it's what i do as well. Just make sure you have the latest version...unlike some people i know (me) ;-) Thanks again! Multiple view help - El Forum - 11-12-2008 [eluser]Pascal Kriete[/eluser] My pleasure. @jwindhorst looks good ![]() |