It seems many people is trying to make Wordpress and Yii work together. I got stuck with the same problem, but now I think I have achieved doing it, after a lot of hard thinking and many work hours spent.
Sometimes we need some complicated view to be displayed (such as generating complicated table). Most people suggest that in MVC the View must be as simple as possible (don't have too much loops, etc). So what we have to do is to hide away the complex code by putting it at somewhere else. The following are few places options to keep the function: