CodeIgniter Forums
Where to put the business logic - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Where to put the business logic (/showthread.php?tid=44042)



Where to put the business logic - El Forum - 08-01-2011

[eluser]Unknown[/eluser]
Hi. I'm a new user with CodeIgniter and I have a doubt about where I need to put my files.

I think I understand perfectly what is the purpose of the controlers, models and views but in my application I have some "business logic"

At the moment, I am putting in the "third_party" folder and I am loading it in the "autoload" file using the "require_once" PHP statement.

But I think that CodeIgniter must provide a more logical solution to this, isn't it?

Again, sorry about my poor English y thanks very much por your patient and effort.


Where to put the business logic - El Forum - 08-01-2011

[eluser]daniel ispas[/eluser]
Hi,

You can use the loader class like this:
Code:
$this->load->add_package_path()
. Here is more about the loader class: http://ellislab.com/codeigniter/user-guide/libraries/loader.html

Hope this helps


Where to put the business logic - El Forum - 08-04-2011

[eluser]JamieBarton[/eluser]
What is the business logic you're referring to?

Do you have any examples?

Normally I would put any business logic that isn't going to be re-used in the Controller, sometimes I'll put it in the Model, it really just depends on the App, and the scale of it for my use.

Show us what you're putting in the third party folder and classing as 'business logic'.

Have a look at Helpers too which you can use for stuff you want to access in your Controllers & Views.


Thanks