Hi
So I was trying ajax with the demo application, for testing purposes.
So I added this to the view/site/index.php
<%= CHtml::ajaxLink("Click me","array('site/updateTarget'),array('update'=>'.target')) %> <div class="target">Target</div>
Then in the site controller
public function ActionUpdateTarget() { $this->renderPartial('index'); }
Clicking the link on the page then renders this error (in the target area)
#0 /home/yiiframework/web/CHttpSession.php(96): session_start() #1 /home/yiiframework/web/CHttpSession.php(83): CHttpSession->open() #2 /home/yiiframework/core/CApplication.php(712): CHttpSession->init() #3 /home/yiiframework/web/CWebApplication.php(216): CWebApplication->getComponent() #4 /home/yiiframework/web/auth/CWebUser.php(83): CWebApplication->getSession() #5 /home/yiiframework/core/CApplication.php(712): WebUser->init() #6 /home/yiiframework/core/CApplication.php(134): CWebApplication->getComponent() #7 /home/public_html/cart/protected/runtime/views/ba4c96d0/index.php(3): CWebApplication->__get() #8 /home/yiiframework/web/CBaseController.php(123): require()
The error is caused by this line
Welcome, <%= Yii::app()->user->name %>!
The "welcome" gets sent then the session is attempted to be initialized. I could manually force the session to start before the view begins to render but shouldn't yii take care of this ? Or am I doing something wrong here ?
Thanks
nz
btw : wow, easy ajax !