Nested tabs - 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: Nested tabs (/showthread.php?tid=40738) |
Nested tabs - El Forum - 04-17-2011 [eluser]Hoopoe[/eluser] Hi, I have a page with tabs. The tabs are nested, and the markup for them is generated dynamically. At the moment it's written in ordinary procedural php. I am trying to move it over to CI. My question is about a key part of the existing code which I want to replicate in CI. Basically, in this section of code I nest a query within a while clause used to loop over results from another query. From my experience of CI, that sort of looping is done in a view, whereas a query is done in the model. This is what bothers me. Any thoughts or guidance gratefully received. Tom Code: <?php Nested tabs - El Forum - 04-17-2011 [eluser]toopay[/eluser] Process the query in model, to generates multi dimensional array, then passed it to view via controller. Extract that values in your view, with nested foreach or while statement. Nested tabs - El Forum - 04-17-2011 [eluser]Hoopoe[/eluser] Thank you: I think I get it. Do a query wh returns all the data wanted - do a foreach loop for the li elements, and foreach foreach loop for the divs Ok haven't tried it yet but now have a direction. Tom |