CodeIgniter Forums
Use controller in third-party folder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Model-View-Controller (https://forum.codeigniter.com/forum-10.html)
+--- Thread: Use controller in third-party folder (/thread-69463.html)



Use controller in third-party folder - omid_student - 11-27-2017

Hello
My project have 2 section (User portal,Admin panel)
I want to place admin panel folder in third party folder
Example :
third_party/admin/controllers
third_party/admin/models
third_party/admin/libraries

In third_party/admin/controllers exist profile.php controller and i need to call this controller in browser
I cannot use add_package_path for use this advance
maybe?


RE: Use controller in third-party folder - Wouter60 - 11-28-2017

You can't do this.
Controllers must be in the controllers folder.
The third_party folder is for .... well ...  third party scripts that don't follow the CI MVC approach straight away.

The documentation says this about controllers:
Quote:Organizing Your Controllers into Sub-directories

If you are building a large application you might want to hierarchically organize or structure your controllers into sub-directories. CodeIgniter permits you to do this.

Simply create sub-directories under the main application/controllers/ one and place your controller classes within them.

The same goes for models:
Quote:Anatomy of a Model

Model classes are stored in your application/models/ directory. They can be nested within sub-directories if you want this type of organization.

And for views:
Quote:Storing Views within Sub-directories

Your view files can also be stored within sub-directories if you prefer that type of organization. When doing so you will need to include the directory name loading the view.



RE: Use controller in third-party folder - omid_student - 11-28-2017

(11-28-2017, 12:59 AM)Wouter60 Wrote: You can't do this.
Controllers must be in the controllers folder.
The third_party folder is for .... well ...  third party scripts that don't follow the CI MVC approach straight away.

The documentation says this about controllers:
Quote:Organizing Your Controllers into Sub-directories

If you are building a large application you might want to hierarchically organize or structure your controllers into sub-directories. CodeIgniter permits you to do this.

Simply create sub-directories under the main application/controllers/ one and place your controller classes within them.

The same goes for models:
Quote:Anatomy of a Model

Model classes are stored in your application/models/ directory. They can be nested within sub-directories if you want this type of organization.

And for views:
Quote:Storing Views within Sub-directories

Your view files can also be stored within sub-directories if you prefer that type of organization. When doing so you will need to include the directory name loading the view.

Yes i use sub-folder controller finally
Thanks


RE: Use controller in third-party folder - omid_student - 11-28-2017

(11-28-2017, 12:59 AM)Wouter60 Wrote: You can't do this.
Controllers must be in the controllers folder.
The third_party folder is for .... well ...  third party scripts that don't follow the CI MVC approach straight away.

The documentation says this about controllers:
Quote:Organizing Your Controllers into Sub-directories

If you are building a large application you might want to hierarchically organize or structure your controllers into sub-directories. CodeIgniter permits you to do this.

Simply create sub-directories under the main application/controllers/ one and place your controller classes within them.

The same goes for models:
Quote:Anatomy of a Model

Model classes are stored in your application/models/ directory. They can be nested within sub-directories if you want this type of organization.

And for views:
Quote:Storing Views within Sub-directories

Your view files can also be stored within sub-directories if you prefer that type of organization. When doing so you will need to include the directory name loading the view.

Can i use sub-folder for libraries?


RE: Use controller in third-party folder - PaulD - 11-28-2017

Yes, as many as you like. And views of course, and models.


RE: Use controller in third-party folder - omid_student - 11-28-2017

(11-28-2017, 01:54 PM)PaulD Wrote: Yes, as many as you like. And views of course, and models.

Thanks