我正在制作一个Joomla系统插件,我需要在其中获取Zoo Joomla组件文章的预告图像。
答案 0 :(得分: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;
}