php - Make RokSprocket to fetch k2 item's video but getting undefined property error -


i'm bulding website joomla, , i'm using roksprocket display featured item on frongpage. roksprocket can use k2 content provider, though can't fetch k2 item's video. tried modify php files got undefiend property $stdclass::video error. here's do:

 roksprocket using function convertrawtoitem convert raw items(in case k2 items) roksprocket items:       protected function convertrawtoitem($raw_item, $dborder = 0) {     //$textfield = $this->params->get('k2_articletext_field', '');      $item = new roksprocket_item();      $item->setprovider($this->provider_name);     $item->setid($raw_item->id);     $item->setalias($raw_item->alias);     $item->settitle($raw_item->title);     $item->setdate($raw_item->created);     $item->setpublished(($raw_item->published == 1) ? true : false);     $item->setcategory($raw_item->category_title);     $item->sethits($raw_item->hits);     $item->setrating($raw_item->rating);     $item->setmetakey($raw_item->metakey);     $item->setmetadesc($raw_item->metadesc);     $item->setmetadata($raw_item->metadata);     $item->setpublishup($raw_item->publish_up);     $item->setpublishdown($raw_item->publish_down);     ................     return $item;  } 

and class roksprocket_item's definition follow:

class roksprocket_item ....... { public function settext($introtext) {     $this->text = $introtext; } public function gettext() {     return $this->text; }....} 

roksprocket setting item's value raw k2 item's corresponding value. because in k2's own pages, uses echo $this->item->title , echo $this->item->video , output k2 item's various values, guess can use k2 item s video value roksprocket uses k2 item's other value. think need 1)adding new "video" value , setvideo/getvideo function class roksprocket_item;

protected $video;     public function setvideo($video) {     $this->video = $video; } public function getvideo() {     return $this->video; }    

2)in convertrawtoitem function, add

    $item->setvideo($raw_item->video); 

3)on front-end, add

   <?php echo $item->getvideo(); ?> 

but frontpage outputs error message saying: undefined property: stdclass::$video in line added "$item->setvideo($raw_item->video);".

what did wrong?

i think error message means $raw_item doesn't have video value, searched in php files check when convertrawtoitem called, , found in abstarctjoomlabasedprovider.php file:

public function getarticleinfo($id, $raw = false) {     /** @var $filer_processor rokcommon_filter_iprocessor */     $filer_processor = $this->getfilterprocessor();     $filer_processor->process(array('id' => array($id)), array(), true);     $query = $filer_processor->getquery();     $db    = jfactory::getdbo();     $db->setquery($query);     $db->query();     if ($error = $db->geterrormsg()) {         throw new roksprocket_exception($error);     }     $ret = $db->loadobject();     if ($raw) {         $ret->preview = $this->_cleanpreview($ret->introtext);         $ret->editurl = $this->getarticleediturl($id);         return $ret;     } else {         $item          = $this->convertrawtoitem($ret);         $item->editurl = $this->getarticleediturl($id);         $item->preview = $this->_cleanpreview($item->gettext());         return $item;     } } 

now i'm stuck here. next totally beyond limited php knowledge, seems having database. hints or teaching highly appreciated.

you need define video standard class

$video = new stdclass; 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -