• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Yet another project layout questions

#1
[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 Smile 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.

#2
[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);

#3
[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.

#4
[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 Smile

#5
[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

#6
[eluser]ironlung[/eluser]
Fantastic I am a happy guy.

Thanks again for your time.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.