Multiple pages - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Multiple pages (/showthread.php?tid=26622) |
Multiple pages - El Forum - 01-18-2010 [eluser]BlueGemini[/eluser] Hi, I need help regarding on how to display multiple pages in one page. Normally in HTML, we use <IFRAME> and specify the path of the certain page you want to display. But how about in CI? Seems the <iframe> is not working within CI (even using base_url() to specify that view page is not working). So, how can I make certain pages display within one page? Thanks in advance! Multiple pages - El Forum - 01-18-2010 [eluser]theprodigy[/eluser] you can just use Code: $this->load->view('header'); Is this what you were talking about? Multiple pages - El Forum - 01-18-2010 [eluser]BlueGemini[/eluser] [quote author="theprodigy" date="1263899185"]you can just use Code: $this->load->view('header'); Is this what you were talking about?[/quote] Not quite... I already did that and it just stack the view results. I wanted to put every pages in the right layout (putting them within <div>) Multiple pages - El Forum - 01-18-2010 [eluser]theprodigy[/eluser] Try storing your views into variables that you pass to your views Code: $data['div1'] = $this->load->view('mydiv1', '', true); then just output your variables in the layout.php view Code: <html> Is that more of what you are looking for? Multiple pages - El Forum - 01-19-2010 [eluser]BlueGemini[/eluser] [quote author="theprodigy" date="1263899986"]Try storing your views into variables that you pass to your views Code: $data['div1'] = $this->load->view('mydiv1', '', true); then just output your variables in the layout.php view Code: <html> Is that more of what you are looking for?[/quote] Hey, it work. :cheese: didn't thought about that... :-P One more question. What is the difference of having a TRUE? Code: $data['div1'] = $this->load->view('mydiv1', '', true); Thank you very much! ;-) Multiple pages - El Forum - 01-19-2010 [eluser]theprodigy[/eluser] The TRUE tells it to RETURN the output rather than ECHO the output. That way you can store it in a variable for use later. (EllisLabs thought of everything ) HINT: if you need to pass variables to the views that you are storing, the second parameter is for that. If you don't, then leave as is. With data being sent: Code: $data['div2'] = $this->load->view('mydiv2', $data_array, true); Code: $data['div2'] = $this->load->view('mydiv2', '', true); Multiple pages - El Forum - 01-19-2010 [eluser]BlueGemini[/eluser] [quote author="theprodigy" date="1263904058"]The TRUE tells it to RETURN the output rather than ECHO the output. That way you can store it in a variable for use later. (EllisLabs thought of everything ) HINT: if you need to pass variables to the views that you are storing, the second parameter is for that. If you don't, then leave as is. With data being sent: Code: $data['div2'] = $this->load->view('mydiv2', $data_array, true); Code: $data['div2'] = $this->load->view('mydiv2', '', true); Now I know :lol: Thank you very much! Multiple pages - El Forum - 01-19-2010 [eluser]jwindhorst[/eluser] You could also just call views from within a primary view: Code: <div> To me this is a more readable (less abstract) solution to the problem, but of course, both work. |