mdomba:
And what is the code that calls the view?
In your first post is
$this->render('../../views/user/loginWidget',
but as the folder is /user/views shouldn’t that be
$this->render('../../user/views/loginWidget',
Hi,
My code is $this->render(’../../user/views/loginWidget’,
but i still get the error even if the file is there is the folder and have not mistyped anything.
LoginWidget cannot find the view "../../user/views/loginWidget".
/home/wolla/yiwolla/framework/web/widgets/CWidget.php(244)
232 * about how the view script is resolved.
233 * @param array $data data to be extracted into PHP variables and made available to the view script
234 * @param boolean $return whether the rendering result should be returned instead of being displayed to end users
235 * @return string the rendering result. Null if the rendering result is not required.
236 * @throws CException if the view does not exist
237 * @see getViewFile
238 */
239 public function render($view,$data=null,$return=false)
240 {
241 if(($viewFile=$this->getViewFile($view))!==false)
242 return $this->renderFile($viewFile,$data,$return);
243 else
244 throw new CException(Yii::t(‘yii’,’{widget} cannot find the view “{view}”.’,
245 array(’{widget}’=>get_class($this), ‘{view}’=>$view)));
246 }
247 }
Stack Trace
#0
–
/home/wolla/public_html/protected/modules/user/components/LoginWidget.php(15): CWidget->render("../../user/views/loginWidget", array("model" => LoginForm))
10 }
11
12 protected function renderContent()
13 {
14 // $path = Yii::app()->getModule(‘User’)->getBaseUrl;
15 $this->render(’../../user/views/loginWidget’, array(‘model’ => new LoginForm()));
16 }
17 }
18 ?>
#1
/home/wolla/yiwolla/framework/zii/widgets/CPortlet.php(95): LoginWidget->renderContent()
#2
/home/wolla/yiwolla/framework/web/CBaseController.php(166): CPortlet->run()
#3
–
/home/wolla/public_html/protected/views/layouts/main.php(63): CBaseController->widget("application.modules.user.components.LoginWidget")
58 <?php
59 $a = Yii::app()->getController()->getAction()->controller->action->id;
60
61 if(Yii::app()->user->isGuest && (strcmp($a,‘login’)<0))
62 {
63 $this->widget(‘application.modules.user.components.LoginWidget’);
64 }
65 //echo “Length =>”.strlen($action)." ====".strcmp($action,‘login’)." -----------".$action;
66 ?>
67 </div>
68 </div><!-- header -->