![]() |
Files structure - 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: Files structure (/showthread.php?tid=40597) |
Files structure - El Forum - 04-13-2011 [eluser]Gerep[/eluser] Hi, I'm trying to find a good way to separate my files into folders. For instance, I'm saving all my classes related to user on Quote:controllers/user/user.php and so on... The bad thing is that when I call the controller user.php I have to place the user folder on my url. Is there a way to take it or another way to organize my files? Thanks in advance for any help. Files structure - El Forum - 04-13-2011 [eluser]adamfairholm[/eluser] I'd try modules (such as Modular Extensions) to keep your application files in modules and nice and separated: https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/overview If you want to organize files other than controllers and views, check out packages as well: http://ellislab.com/codeigniter/user-guide/libraries/loader.html Files structure - El Forum - 04-14-2011 [eluser]donjim[/eluser] I have a similiar question about the file structure, hope u dont mind I also post in your tread. Lets say i have companies Code: company/view/ I also have persons Code: person/view/ And then I would like to add a new person and, bind him/her to an company, what is the nicest or more correct file structure aproach? could I make company as a folder and then a Controller edit/add? like.. Code: company/edit/person Am I thinking in acceptable MVC terms here? Files structure - El Forum - 04-14-2011 [eluser]adamfairholm[/eluser] donjim, What you are talking about is more application organization than MVC - your URL structure is really up to you, and it is dictated by what the needs of your application are building, so whether you use company/edit/person or person/company/edit, is more of a organization question. When you edit a person, why not have a drop down for a company as well instead of having a separate method for just editing the person's company? That way you could have person/edit and have everything in one place. I'd recommend getting away from thinking of the first URI segment as a folder though, with different controllers for edit and view and other operations like that. If you have a company controller, then you can have edit and view functions within those, and keep things a lot cleaner. You can use routes to route more complex urls to your controllers as well. Hope that helps! Adam Files structure - El Forum - 04-14-2011 [eluser]InsiteFX[/eluser] With HMVC your structure would be like this: Code: modules - root of modules. InsiteFX |