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 form开发者_运维知识库er seems cleaner, but it's not obvious to me how to make the Doohicky class available to Widget.
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
I see the question has been answered already, but there are a few things to bear to expand on it.
You could put widgets and doohickies in the libraries
folder, if they are there to do a job rather than provide a data service.
Also, take a look at HMVC, which favours the idea that you can have mini-apps that look after various parts of your website (e.g. messages panels, search box/results, doohickies...). This enables you to have smaller view partials dedicated to their widget controllers; and then the main controller calls in widgets but doesn't need knowledge of how they came about.
http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/
精彩评论