![]() |
help with loading multiple 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: help with loading multiple views (/showthread.php?tid=27298) |
help with loading multiple views - El Forum - 02-06-2010 [eluser]DumpProgrammer[/eluser] I am working on my first website with CI. I have done my view file template.php like this Code: <?php $this->load->view('newheader'); ?> help with loading multiple views - El Forum - 02-06-2010 [eluser]bretticus[/eluser] Congratulations and welcome to CI. I think you are using the "model" of loading a single view template that, in turn, loads another view to display the content you need. This method is a little unorthodox but it will work. Another method is to call the views individually (just like you have them minus all the duplicate php tags) in the controller: Code: <?php Of course, if you want to stay with the template model, you need to load that view from the controller: Code: <?php and then in your template.php view: Code: <?php $this->load->view('newheader'); ?> help with loading multiple views - El Forum - 02-07-2010 [eluser]DumpProgrammer[/eluser] Thanks you have helped me a lot. Now I think I will be able to work with the pagination on the single view because thats where I realised I had a problem with this method of loading multiple views in template file. Here is glimpse of the new controller Code: class Blog extends Controller { help with loading multiple views - El Forum - 02-07-2010 [eluser]Udi[/eluser] I heavily recommend you to read my 3 blog posts about developing CMS with CodeIgniter, the first one: http://blog.umnet.co.il/2009/11/25/developing-content-managment-system-with-codeigniter-part-1/ I will help you to start coding with the right approach. help with loading multiple views - El Forum - 02-08-2010 [eluser]DumpProgrammer[/eluser] thanks I have had a look at your blog and its a good tutorial. |