开发者

Creating non-framework classes in CakePHP

I'm making a tournament manager in CakePHP 1.3 and I have a tournament controller which is fine but I want to implement a interface that can be used to define how a tournament runs.

the controller needs to load a concrete class that开发者_运维百科 implements the TournamentStyle interface that defines how the tournament works. At the end of a round the TournamentStyle is used to calculate the scores and winners and generate the next round of matches.

That gives me a .php file for the interface and other files for the various styles. My question is: where would I put these files and how would I load them into my tournament controller?


You can throw the interface into app/vendors and use App::import() to load it.


I would put those files in either app/libs or app/vendors depending on where you feel like putting them. Both libs and vendors can have files loaded with App::import(). You could also use plain old include.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜