Best practices for breaking up code |
[eluser]GeXus[/eluser]
I'm working on a project that has a members area and non-members area. Basically, everything inside the members area uses the controller member.php (/member/). I'm using functions within to break it up now, so member/join, member/home, etc. However, there are going to be quite a few pages here within the member controller and having 20+ long functions in one page isn't the greatest.... Does anyone have suggestions or is there a way to break this up? So I could still have /member/function but maybe in a different file?
[eluser]ChrisMiller[/eluser]
Inside your application/controllers/ folder you can make sub folders for different sections and then place controllers within that. Examples: http://yoursite.com/members/join ='s system/application/controllers/members/join.php http://yoursite.com/members/login ='s system/application/controllers/members/login.php http://yoursite.com/index ='s system/application/controllers/index.php http://yoursite.com/somefolder/action ='s system/application/controllers/somefolder/action.php Enjoy,
[eluser]GeXus[/eluser]
Hm... Okay so here's what I had: /controllers/member.php Now I have: /controllers/member/index.php Where index.php has the contents of member.php When I go to /member/join (which is a function in /member/index.php) it goes to the old file however
[eluser]ChrisMiller[/eluser]
You have to remove the old files so it does not attempt to use them.
[eluser]GeXus[/eluser]
Yeah, I did.. do I need to update htaccess or add routes or anything?
[eluser]mdhb2[/eluser]
please look at Modular Separatin (just use forum search) and here what i did with Modular: APP |__ controllers |__ ... |__ modules |__ member |__controllers | |__ join.php | |__ login.php |__views |__models And there url's will be : sitename/member/join sitename/member/login
[eluser]GeXus[/eluser]
Nick, Thanks... although It looks like from what Chris is saying I can break it up, if that's correct, that would be ideal, without using another library. Any ideas if that's possible? |
Welcome Guest, Not a member yet? Register Sign In |