Refresh Only $Content Part Of Main.php


I am new to yii framework. I read the documents about rendering but could not still find an answer to my question.

I have main.php with my navigation menu and site views that are rendered and put into $content. I want only $content to be refreshed when I select on of my navigation buttons. I know how to do that with js but could not figure out how to do it in yii due to call to index.php. Example page links or codes will be great.


When calling your actions using AJAX you need to perform a renderPartial() instead of render() on your views. That will output only your views, without the layout. Then you can use this response to replace page contents using JS when processing AJAX result.

You can detect AJAX call in an action by reading the Yii::app()->request->isAjaxRequest property.