Member Avatar for iamthwee

Morning guys,

I would like someone to clarify my doubts with Codeigniter's file structure.

The CI default structure is

-application
-system

but I have a lot of other files in the same directory like, phppdf, images, etc
is it better to further separate them into another subdirectory for clarity such as

-application
-system
--resources
---phppdf
---images

I'm like this better as it looks more organised, although it may mean rewriting the paths inside my controllers.

Recommended Answers

All 5 Replies

And your question is? You want to make it look more/easily readable?

Yes, feel free to add your own additional directories and subdirectories. For example, when your controllers call the views, instead of passing in just the name of the template file, such as 'foo', you can pass in 'directory/foo'.

Member Avatar for iamthwee

Yes Dani I am definitely doing that within the views however, I am not doing that with my other resources or third party libraries.

I'm just sticking them in the root folder which I don't particularly like. Trouble is my application is growing so I guess I just have to bite the bullet and rewrite my controllers.

Yeah, I would just avoid putting files in folders like helpers, etc. where the framework searches through the directory and automatically includes classes in there that it finds.

Some practice I've met and started to use was to have folder named assets in the root:

-application
-assets
--css
--img
--js
-system
.htaccess
index.php

Third party libraries are meant to be in application/third_party folder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.