oligalma
(Marc Oliveras)
1
My hosting, Godaddy, has the following PHP versions to choose from: 5.3, 5.4, 5.4 (Native) and 5.5.
In my application, I get the following error if I set PHP version to 5.4 or 5.5:
Non-static method CController::createUrl() should not be called statically, assuming $this from incompatible context
However, it works well with 5.3 and 5.4 (native).
I really want to set the version 5.5. What should I do?
konapaz
(Konapaz)
2
Hi
createUrl is not a static method
http://www.yiiframework.com/doc/api/1.1/CController#createUrl-detail
So, you souldn’t use it as static
In previous PHP version warnings (or errors) may not occurs
Why call it directly ?
You could use it as
$this->createUrl(...)
when $this is your current Controller
konapaz
(Konapaz)
3
Hi again!
In addition if you don’t want use anyway the current Controller you chould use the createUrl method of the CWebApplication
Yii::app()->createUrl(...)
//or
Yii::app()->createAbsoluteUrl(...)
oligalma
(Marc Oliveras)
4
Yii::app()->createUrl worked!!!
$this->createUrl didn’t work, as I was using it inside a CGridView and I got the following error:
CButtonColumn and its behaviors do not have a method or closure named "createUrl".