2014-02-14 46 views

回答

0

我已經做了變通:在getZooArticleTeaserImg函數返回的圖像路徑

function getZooArticleTeaserImg($articleId){ 
    require_once(JPATH_ADMINISTRATOR.'/components/com_zoo/config.php'); 
    $zapp  = App::getInstance('zoo'); 
    $zooitems = $zapp->table->item->all(array('conditions' => 'id = '.$articleId)); 
    $imgpath = ''; 

    foreach($zooitems as $zooitem){ 
     foreach ($zooitem->getElements() as $zooid => $element){ 
      if(in_array($element->getElementType(), array('image', 'media'))){ 
       if($element->config->get('name') == 'Teaser Image'){ 
        $imgpath = $element->get('file'); 
       } 
       else if(!$imgpath && $element->config->get('name') == 'Image'){ 
        $imgpath = $element->get('file'); 
       } 
      } 
     } 
    } 

    return $imgpath; 
}