Welcome Guest, Not a member yet? Register   Sign In
Sub sub-folders not working in controllers
#11

[eluser]xwero[/eluser]
[quote author="Shpigford" date="1201044964"]Yes, the collections would integrate with the store.

So you're saying my /controllers would look something like this?

/controllers/admin/store.php
/controllers/admin/forum.php
/controllers/admin/users.php
/controllers/store.php
/controllers/forum.php[/quote]
Yes that was what i had in mind.
#12

[eluser]adamp1[/eluser]
The problem with not having nested sub folders is you normally have one to separate admin controllers from public controllers. Now you can have more sub folders like this 'admin' one for the public area, but you can't have any for the admin area (since where already 1 folder deep). Which means all your admin controllers must be in a single folder. Now say I have a hugely complex backend and its spread across many many controllers. I don't want all these in a single folder, yes it could work but its horrid to work with.

So a little example, if you want the following the current setup is fine:
Code:
/admin
    users.php
    manage.php
  home.php
  view.php

But if I have many controllers which are all related, but are so individually complex I don't want them in a single controller we end up with this. (Lets say each controller is 1000 lines long and each have their own add/edit/delete option)
Code:
/admin
    package1_subcontroller1.php
    package1_subcontroller2.php
    package1_subcontroller3.php
    package1_subcontroller4.php
    package2_subcontroller1.php
    package2_subcontroller2.php
    package2_subcontroller3.php
    package2_subcontroller4.php
  home.php
  view.php

Now as you can see that's not very nice. Now some say use routes, but using routes that's another part of the program to break and update if I want to add something. Why add more complexity if you can use folders to do the job? The way CI is setup at the moment for controllers is crazy to me atm.

One last thing, if the change proposed in this was implemented it wouldn't break any old code, so if you didn't want to use it, you don't have to.post
#13

[eluser]xwero[/eluser]
@adamp1 : More sublevels can be useful but it could be a maintenance nightmare if controllers get spread around
Code:
/sub1
   /sub2
     /sub3
       controller
   /sub2b
     controller
     controller
   /sub2c
     /sub3b
       /sub4
         /sub5
           controller
Real life examples have a less obvious directory naming.
#14

[eluser]adamp1[/eluser]
How is this a maintenance nightmare? I would have thought real life directory's would have a better naming convention. It seems mad not to use folders since folders are only for us humans, the computer doesn't need them.
Code:
/admin
    /server
      logs.php
      settings.php
      stats.php
    /users
      search.php
      manage.php

Or would this be better?

Code:
/admin
    logs.php
    settings.php
    stats.php
    search.php
    manage.php

I don't know about some people but the first puts each controller in its related folder, while the second is a total mess. What's the stats.php controller for? Users or the server (Well I can't tell straight away).

Yes I could put a prefix before each but that makes the file names and url more messy.

EDIT:
Really all that is needed is one extra level of sub folders. So max 2 deep, that would then let us to achive everything.
#15

[eluser]Michael Wales[/eluser]
Quote:Yes I could put a prefix before each but that makes the file names and url more messy.
Filename has nothing to do with URL - thanks to routing.
#16

[eluser]adamp1[/eluser]
[quote author="adamp1" date="1201052586"]Now some say use routes, but using routes that's another part of the program to break and update if I want to add something. Why add more complexity if you can use folders to do the job? The way CI is setup at the moment for controllers is crazy to me atm.[/quote]

Having routes just means I have yet another file to update when I want to add a new controller. Why add more complexity using routes unless you really have to? Theres clearly another solution which doesn't require any extra code per application bases (only the update to the core).
#17

[eluser]xwero[/eluser]
[quote author="adamp1" date="1201054064"]How is this a maintenance nightmare? I would have thought real life directory's would have a better naming convention. It seems mad not to use folders since folders are only for us humans, the computer doesn't need them.
[/quote]
When another developer gets started on the project and finds empty directory after empty directory he will have no good feeling about the code.
The point i was trying to make is that unlimited subfolders can lead to excesses.

As i said before more levels of subfolders can be useful but i think its better to keep the controllers together as much as possible.




Theme © iAndrew 2016 - Forum software by © MyBB