Centos deployment

i have this working on my windows 7 machine $this->render(’../../views/user/loginWidget’, array(‘model’ => new LoginForm()))

but when i deploy to my linux shared hsoting account i get an error the LoginWidget cannot find the view

can any one help me.

most usual error happening when switching from windows to unix is the case sensitivity… but as you did not post any error message I don’t see how anybody can help you.

here is the error.

My View for this widget is located under

on my Windows 7

H:\wamp\www\wolladev\protected\modules\user\views

Widget Location on Win 7

H:\wamp\www\wolladev\protected\modules\user\components

On The Linux server

public_html\protected\modules\user\views

public_html\protected\modules\user\components

LoginWidget cannot find the view "../../views/user/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 }

/home/wolla/public_html/protected/modules/user/components/LoginWidget.php(15): CWidget->render("../../views/user/loginWidget", array("model" => LoginForm))

10 }

11

12 protected function renderContent()

13 {

14 Yii::app()->getModule(‘Account’);

15 $this->render(’../../views/user/loginWidget’, array(‘model’ => new LoginForm()));

16 }

17 }

18 ?>

you wrote that it is located in …/user/view… but the error say …/views/user… typing error or a bug?

and check the proper case of the view file "loginWidget" - W uppercase all other lowercase… on widows it does NOT matter… but on linux it DOES matter

Hi,

The files are typed exactly the same . Why should it work on windows and work on linux if the there is no difference in the file name?

Do you thing is a bug on the framework?

windows is case-insensitive, linux is case sensitive… so if the file is called loginwidget.php but in your code you use loginWidget on windows this will work… but on linux you will get the error "file not found"

What is with the user/view - view/user ?

You wrote that the view is located in …/modules/user/views but you use $this->render(’…/…/views/user/…

I have

on linux

/home/wolla/public_html/protected/modules/user/views/ my view [ loginWidget.php] is here

my widget folder is here

/home/wolla/public_html/protected/modules/user/components my widget [LoginWidget.php] is here

how should i render my view in my widget?

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 -->

This seems quite obviously a path, or as mentioned, a ‘case’ sensitivity issue.

I wonder have you tried something like this to avoid the path issue?


$this->render('application.modules.user.views.loginWidget');

This assumes you’re using a module. Edit to your needs.

My usual development environment seems similar to yours. Develop on Win7, deploy to Centos 5.5. I have no issues.

Thank you it now works.