Yii Framework Forum: Yii::app()->clientScript Exception :( - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Yii::app()->clientScript Exception :( Rate Topic: -----

#1 User is offline   KJedi 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 381
  • Joined: 19-October 08
  • Location:Nikolaev, Ukraine (Europe)

Posted 02 December 2008 - 12:22 PM

I've downloaded Portlet and Login portlets and put them to the extension dir.
Then in the main layout I wrote:
<?php $this->widget('application.extensions.login.XLoginPortlet',array(
    'visible'=>Yii::app()->user->isGuest,
)); ?>

It showed me CException page:
00122:     /**
00123:      * Getter magic method.
00124:      * This method is overridden to support accessing application components
00125:      * like reading application properties.
00126:      * @param string application component or property name
00127:      * @return mixed the named property value
00128:      */
00129:    public function __get($name)
00130:    {
00131:        if($this->hasComponent($name))
00132:            return $this->getComponent($name);
00133:        else
00134: return parent::__get($name);
00135:    }
00136:
00137:    /**
00138:      * Runs the application.
00139:      * This method loads static application components. Derived classes usually overrides this
00140:      * method to do more application-specific tasks.
00141:      * Remember to call the parent implementation so that static application components are loaded.
00142:      */
00143:    public function run()
00144:    {
00145:        $this->onbeginRequest(new CEvent($this));
00146:        $this->processRequest();

Stack:
#0 /usr/home/konstantin/TVSMedia/EveryStyle/framework/base/CApplication.php(134): CComponent->__get('clientScript')
#1 /usr/home/konstantin/TVSMedia/EveryStyle/testdrive/protected/extensions/portlet/XPortlet.php(62): CApplication->__get('clientScript')
#2 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CBaseController.php(141): XPortlet->init()
#3 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CBaseController.php(152): CBaseController->createWidget('application.ext...', Array)
#4 /usr/home/konstantin/TVSMedia/EveryStyle/testdrive/protected/views/layouts/main.php(26): CBaseController->widget('application.ext...', Array)
#5 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CBaseController.php(119): require('/usr/home/konst...')
#6 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CBaseController.php(88): CBaseController->renderInternal('/usr/home/konst...', Array, true)
#7 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CController.php(420): CBaseController->renderFile('/usr/home/konst...', Array, true)
#8 /usr/home/konstantin/TVSMedia/EveryStyle/testdrive/protected/controllers/SiteController.php(27): CController->render('index')
#9 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/actions/CInlineAction.php(32): SiteController->actionIndex()
#10 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CController.php(207): CInlineAction->run()
#11 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CController.php(192): CController->runAction(Object(CInlineAction))
#12 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CController.php(167): CController->runActionWithFilters(Object(CInlineAction), Array)
#13 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CWebApplication.php(146): CController->run('index')
#14 /usr/home/konstantin/TVSMedia/EveryStyle/framework/web/CWebApplication.php(118): CWebApplication->runController('site', 'index')
#15 /usr/home/konstantin/TVSMedia/EveryStyle/framework/base/CApplication.php(146): CWebApplication->processRequest()
#16 /usr/home/konstantin/TVSMedia/EveryStyle/testdrive/index.php(11): CApplication->run()
#17 {main}

I searched the forum and found thread where there were problems with clientScript also. There Qiang recommended upgrading to the latest SVN. I configured SVN on my server and checked out latest revision, here is version of the CApplication:
@version $Id: CApplication.php 314 2008-12-01 18:32:23Z qiang.xue $


What's the problem with it? Maybe I'm missing some configs? I re-read article about extending Yii, about creation widget, but didn't see anything about extra config there.

What I'm doing wrong?
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,875
  • Joined: 04-October 08
  • Location:DC, USA

Posted 02 December 2008 - 08:40 PM

Please double-check CWebApplication.php in your Yii copy and make sure it contains a method called getClientScript.
0

#3 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 03 December 2008 - 12:27 AM

I have the same problem.  I noticed exactly the same behaviour in r297 so I have used an older version (2008-11-22) until now. The problem is still there in r318. getClientScript() is present in CWebApplication.

/Tommy

0

#4 User is offline   KJedi 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 381
  • Joined: 19-October 08
  • Location:Nikolaev, Ukraine (Europe)

Posted 03 December 2008 - 04:16 AM

Solution is:
1) upgrade to latest svn
2) in XPortlet.php on line 62 place:
$cs=Yii::app()->getController()->getClientScript();

instead of
$cs=Yii::app()->clientScript();

Maybe
$cs=Yii::app()->getController()->clientScript();
should work also, I didn't test it.

Qiang, please update the XPortlet and write a note, that it needs upgrading to the latest svn.
0

#5 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,875
  • Joined: 04-October 08
  • Location:DC, USA

Posted 03 December 2008 - 07:51 AM

tri: do you mean you still have problem in using (the latest) XPortlet with r318?

0

#6 User is offline   KJedi 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 381
  • Joined: 19-October 08
  • Location:Nikolaev, Ukraine (Europe)

Posted 03 December 2008 - 08:04 AM

Sorry, when I removed old framework and checked our from SVN, the code
$cs=Yii::app()->clientScript();
works perfect. Everything is fine with the code, /dev/hands have errors ;)
0

#7 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 03 December 2008 - 09:07 AM

Works fine with the updated XPortlet (2008-11-25).
Thanks,
/Tommy

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users