faysalmirmd

How to Get Teaser Images Of articles in zoo Jooml component

Feb 14th, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.16 KB | None | 0 0
  1. require_once(JPATH_ADMINISTRATOR.'/components/com_zoo/config.php');
  2.                         $zapp     = App::getInstance('zoo');
  3.             // $item->id is article id
  4.                         $zooitems = $zapp->table->item->all(array('conditions' => 'id = '.$item->id));
  5.                         $imgpath  = '';
  6.                        
  7.                         foreach($zooitems as $zooitem){
  8.                             foreach ($zooitem->getElements() as $zooid => $element){
  9.                                 if(in_array($element->getElementType(), array('image', 'media'))){
  10.                                    if($element->config->get('name') == 'Teaser Image'){
  11.                                       $imgpath = $element->get('file');
  12.                                    }
  13.                                    if(!$imgpath && $element->config->get('name') == 'Image'){
  14.                                        $imgpath = $element->get('file');
  15.                                    }  
  16.                                 }
  17.                             }
  18.                         }
  19.                         if($imgpath){
  20.                             $img_temp = true;
  21.                         }
Advertisement
Add Comment
Please, Sign In to add comment