EllisLab text mark
Advanced Search
     
use modules in the application folder
Posted: 29 June 2007 11:20 AM
Joined: 2007-06-29
5 posts

Hi

I’m new with code igniter, but I have a question about modules. I used Zend Framework and their you could set a module structure. For example, my application structure:

http://www.pastebin.be/3404

url example: http://www.mywebsite.com/forum/topic/view/325

forum = module
topic = controller
view = action

Can I create this structure in code igniter and how do I set the controller to this structure?

Thanks

 
Posted: 29 June 2007 01:03 PM   [ # 1 ]   [ Rating: 0 ]
Joined: 2007-04-16
5 posts

yes you can do, create a folder called forum in the controllers directory then create a new controller called topic in controllers/forum directory, and define a function in the topic contoller called view smile and than write whatever you want into view function.

 
Posted: 29 June 2007 01:11 PM   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-06-29
5 posts

I’m gonna test that Gurkan OLUC, but do I have to change the $application_folder in the index.php?

 
Posted: 29 June 2007 01:21 PM   [ # 3 ]   [ Rating: 0 ]
Joined: 2007-04-16
5 posts

no, it is not reqired smile you don’t have to change anything in config files

 
Posted: 29 June 2007 08:08 PM   [ # 4 ]   [ Rating: 0 ]
Joined: 2007-06-29
5 posts

ok thanks, but do I have to do the same thing for the models and views?

 
Posted: 30 June 2007 09:14 AM   [ # 5 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-27
198 posts

to bundle the controller/modules/views of your ‘module’
you need to use modular separation

now you can have a structure like this:

application/modules/your_modulename/controllers
application/modules/your_modulename/models
application/modules/your_modulename/views

application/modules/your_modulename2/controllers
application/modules/your_modulename2/models
application/modules/your_modulename2/views

and you can call this then with: index.php/your_modulename/controller

now you can just copy your module to another location (CI installation)
with the normal CI installation you have to copy files in 3 different folders and that makes you crazy after a while
I hope this helps..