Welcome Guest, Not a member yet? Register   Sign In
Folders vs Prefix Tags

I'm a little into developing my app with CI and was thinking about using folders instead of prefix tags.

Right now, my view files are separated using folders due to the amount of them but my models and controllers are all in the base folder and i'm using prefix tags for organization.

etc... same goes for models.

Main reason I wanted it this way was for url simplicity and sharing between controllers and models. App is fairly large but this way will work.

I've been reading a lot of "best practices" lately but this one is sorta hard to fine.

What's everyone's opinion?

Looking into more of the CI documentation, it looks like folders might be good, but not really considered a "best practice"


well not sure if this is correct 'best practice' in this case or not but this is my structure:

first off, for class files in the core folders of controllers, and views i primarily use folder based structure.

My Application requires a seperate members area to the rest of the site (eg: seperate from the front end).

--/admin <all controllers for administration are in here>
--/members <all controllers for members area in here>
welcome.php <this is a streamlines controller that handles all the front end pages which are dynamic>

--/admin <contains all the admin themes each on has it's own root folder in here>
--/common <any view partial that is required by admin, members area, and front end>
--/members <themes for members area, can be overridden if desired and use front end theme>
--/themes <front end site themes>


Now modules are a bit of a different thing, file prefix 'tags' in modules to simplify the structure.

admin_ prefix is used for just that, members_, and public_

these tags are used in controllers and views.

models and library classes are a flat file structure, each class file is is given a meaning full name as to what it is for eg: forum_model, ect ...

but like i mentioned, is this 'best practice' ? probably not. But it works for what i am doing and makes sense to me for the most part.

I see where you're coming from. That was sort of my thinking going tags basically because each group doesn't have too many controllers, maybe 3 max each BUT users can belong to multiple groups and use different controllers lots so for the sake of url tidiness, I decided to use tags.

But I like what you said in your last statement
"but like i mentioned, is this ‘best practice’ ? probably not. But it works for what i am doing and makes sense to me for the most part."

This is a great way of thinking and one I should follow. The way I'm doing it works for me and my application. It makes sense and I can follow it easily.

Thanks for the info!

Theme © iAndrew 2016 - Forum software by © MyBB