Extensions and folder structure

I want to start off by stating that I am totally new to Yii, I’ve used several other “frameworks” in the past and I’ve been reading a lot on Yii lately. I’m thinking of using Yii for my next project but after going through some of the documentation I’m still a little fuzzy on a few things.

I’m starting off with integrating Smarty, I’ve used it in the past and I have a lot of code written that saves me time when generating forms etc. I’ve looked through what I could find on the net and I see 3 different ways of doing this. Now I’m not referring to the code really, that I understand, but where is the proper place to add these extensions?

Do I create a ViewRenderer under framework/web/renderers? Do I place it in my application protected folder? My concern is when it comes time to upgrade Yii I don’t want to be comparing files in the framework folder. In Kohana

(love hate) I would have created a module and placed all files there outside of the "framework" folder. Also, when the documentation refers to the application folder, is this the folder for my project I created? Thanks again.

Fred.

at first place, you -must- understand Yii more deeply (not so much, but sufficient), try out demos and the fundamentals of using models, views, controllers and its actions, forms, etc. Is very basic, but powerfull.

bluyell,

Thanks for the response. I have familiarized myself with much of the documentation and code base via the API documentation. I was asking more of where I place extension for such things as a ViewRenderer so that my code base is upgrade safe and as efficient as possible.

It depends. :)

I usually put custom components in ‘components’, but if I create an extension (which is basically a collection of files instead), I put them in ‘extensions’.

If it is a widget, it usually goes in ‘widgets’ - unless, of course, that widget is an extension…

In which case it would go in ‘extensions’.

There is not really a lot of rules here.

So, how do you get started, then?

I started by downloading and looking at various extension, so I suggest that you do the same.

jacmoe,

I think I’ll go with with sticking the customer renderer in my “application” folder, protected/extensions/renderers. Thanks for the tips.

under protected/components folder, and, if need more organization on it ( components/mycomponent/mysubfolder1/etc ) then you need to tell Yii that this folders will be loaded too, this is done in protected/config/main.php:

(file: protected/config/main.php)

'import'=>array(


	'application.models.*',


	'application.models.design.*',


	'application.components.*',       // this will load and import all files under components folder,


            'application.components.mycomponentfolder.*',   // and this, will load an example sub folder, if you wish...


),