Skip to content
Advertisement

Where do you put non-controller classes in codeigniter?

I’ve got a class Widgets. Widgets are made up of Doohickies. I’m never going to need to access Doohickies directly via url — they’re essentially a private class, only used by Widgets. Where do you put your code to define the Doohicky class? In /app/controllers/doohicky.php? in app/controllers/widget.php? somewhere else? Obviously, the former seems cleaner, but it’s not obvious to me how to make the Doohicky class available to Widget.

Advertisement

Answer

It sounds like your Widgets and Doohickies are probably Models in MVC architecture.

In which case, your paths would be:

app/models/widget.php
app/models/doohickies.php
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement