Component usage


I'm evaluating the yii framework and I must say that I like it. Based on samples, I try to use Filters, Action, Widgets etc … My problem is that I'm not used to the 'component' concept (I was using CI, and no component were available) and unfortunatly, I'm sure how to start writing my own component, and what would be its best usage.

For instance, let's say I want to develop a very basic blog system. Would it be appropriate to write a component that would retrieve a post list depending on a category/sub category, visitor group, etc … ?

Is there a sample code I could use for a start ?

Thanks for your help


Welcome aboard!

A component is a self-contained software unit that can be as simple as a class, or as complex as a sub-application.

I suggest you read this tutorial section first:


For an example of a login portlet, take a look at: http://www.yiiframew…xtension/login/

oh sorry, I skipped the extension chapter, I thought it was related to another type of “feature”… now everything is clear like pure water  ;)

Thanks for your help qiang, and for replying so fast  ;D

I'll continue my exploration of this great framework …