yii project structure question

Hi!

Simple quesiton

I have to keep somewhere my shoppingCart class, in what folder I have to keep it ?

it’s not a controller or a model or a view, maybe I need to put it into components folder ? I’m not sure. or maybe it’s better to create new folder called “class” and put such classes there ?

hehe this just depend you preference .

to me , if the class is not a child class of Yii CComponent , i will create some other folder to hold it :

eg lib/myProjName/classes or myProjName/classes .

surely you can put it into the components dir but better to create a subdir

don’t forget the pathalias , in config file you may add your dir to imports:





   'import' => 'application.myProjName.classes.*',




or explicit import it when you use your class : Yii::import(‘application.lib.myProjName.classes.shoppingCart’);

:lol: