This is large application working fine online,
I am trying to use download all the file and configure it in local machine,
I successfully download and configure
But I stuck on this point, where error is
Non-static method Video::getVideoDetails() should not be called statically, assuming $this from incompatible context
As over Stackoverflow question, I get some clue to remove E_Strict
from error_reporting
I used E_ALL
. but the error is still there
here is the part of code
foreach($modelvideo as $bannerVideo):
$videoTitle=Video::getVideoDetails($bannerVideo->id);
$videoDirector=Video::getDirector($bannerVideo->user_id);
?>
<div class = 'item'>
I am not the php developer, I really appreciate if you find easily way to solve this issue.
thanks
Just change the lines from these
foreach($modelvideo as $bannerVideo):
$videoTitle=Video::getVideoDetails($bannerVideo->id);
$videoDirector=Video::getDirector($bannerVideo->user_id);
?>
<div class = 'item'>
to
foreach($modelvideo as $bannerVideo):
$video = new Video();
$videoTitle=$video->getVideoDetails($bannerVideo->id);
$videoDirector=$video->getDirector($bannerVideo->user_id);
?>
<div class = 'item'>
getVideoDetails
and getVideoDetails
are static functions and depend only $bannerVideo->id
and $banner->user_id
respectively. Alternatively you can declare them to be static function by changing
public function getVideoDetails
to
public static function getVideoDetails
in the model function, However this will affect other places were the functions are called, so unless you know what you are doing don't change the model.
Use the following exact line
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
Make sure you do not have ;
before the above statement. which comments the line
Also you can turn off the errors from displaying.
display_errors = On
The above tricks will only make the application work but the problem still exists until you correct static calls to non static calls in all over the application.
$videoTitle=Video::getVideoDetails($bannerVideo->id);
$videoDirector=Video::getDirector($bannerVideo->user_id);
to
$video = new Video();
$videoTitle=$video->getVideoDetails($bannerVideo->id);
$videoDirector=$video->getDirector($bannerVideo->user_id);
Or the otherway by making those functions static. But that is somewhat risky. Because there might be having $this->
calls within the function which generates errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With