 <p>You may have to do this with the beforeRender() function.</p> <p>These links may help.</p> <p><a href="http://www.yiiframework.com/wiki/249/understanding-the-view-rendering-flow/" rel="nofollow">http://www.yiiframework.com/wiki/249/understanding-the-view-rendering-flow/</a></p> <p><a href="http://www.yiiframework.com/wiki/54/" rel="nofollow">http://www.yiiframework.com/wiki/54/</a></p>