Yet another project layout questions - 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: Yet another project layout questions (/showthread.php?tid=17654) |
Yet another project layout questions - El Forum - 04-11-2009 [eluser]ironlung[/eluser] Hi all, sorry to bother but I have a quick question. I am fairly new to all this so its probably a very easy answer if I get my questions across correctly I am writing my first project using CI and I think its awesome, thanks for the hard work everyone. I have a distinct set of controllers, views and models that deal with my data maintenance and I want to separate these off somehow now I am ready to build the main front end. I am sure that HMVC would be the way to go and I have read a lot about it but I can't get my head around it just yet. How easy is it to throw the models/views and controllers into separate subdirectories or should I just move the controllers out and leave the models/views in their existing locations? Thanks in advance. Yet another project layout questions - El Forum - 04-11-2009 [eluser]slowgary[/eluser] They already are in separate subdirectories. I'm pretty sure you can move them wherever you want. I know with views you can just stick the path right in the view() call, like so: Code: $this->load->view('subfolder/view', $data); Yet another project layout questions - El Forum - 04-11-2009 [eluser]TheFuzzy0ne[/eluser] You can also place libraries and controllers into subdirectories. However, with controllers, you can only go one level deep, ie. ./system/application/controllers/subdir/controller_file.php. Yet another project layout questions - El Forum - 04-11-2009 [eluser]ironlung[/eluser] Thats absolutely great thanks guys, I was getting a little confused because I read somewhere that I couldn't move Views in-particular around as I am using a Template Library thats expects views to be in the views folder. However if I can move models and controllers into subdirs of there main dir with no problems, thats fabulous. Thank you very much Yet another project layout questions - El Forum - 04-11-2009 [eluser]TheFuzzy0ne[/eluser] The template library will look in the views directory, but should still support subdirectories, too. You'd just load your view using the relative path from the views directory. e.g. forums/main_view Yet another project layout questions - El Forum - 04-11-2009 [eluser]ironlung[/eluser] Fantastic I am a happy guy. Thanks again for your time. |