yii blog tutorial question.

I am reading the yii framework blog tutorial on


However, I am not sure what the code below do.

foreach($models as $model)



in the loaditem static function.


Where do [$model->code] and $model->name come from and what does this line of code do?

Thanks for help.

In the Overall Design section of the blog tutorial you’ll find the informations about the lookup table.

I’ll try to explain:

private static function loadItems($type)


    self::$_items[$type]=array(); // init an empty array inside the $_items array with key $type

    // Get all lookups for the passed $type e.g. with $type = 'PostStatus' you get all

    // available stati for posts, wiith $type = 'CommentStatus' you get all

    // availabel stati for comments.






    // Loop over the result from the db. $model represents one row in the lookup table and the informations are

    // accessible via $model->code, $model->name, etc. cause the data was fetched from the db via Acitve Record.

    foreach($models as $model)


    // Finally the $_items array (=self:$_items) contains e.g. the following values

    // self::$_items['PostStatus'][1] = 'Draft'

    // self::$_items['PostStatus'][2] = 'Some Post Status'

    // ...


Cause the functions are all static you can later use e.g. in a view


// or


like in the Post admin view.

i have made a website in yii… and also merged the yii blog in it… i want to use two themes , one for default website and one for the blog, can i do this?