Joomla2.5 flexicontent obtains the image file in the flexicontent module.

Source: Internet
Author: User

 <?php   defined('_JEXEC') or die('Restricted access');  foreach ($ordering as $ord){            if (!isset($list[$ord]['standard'])) {         continue;      }      $big_html = '';      $btn_html = '';            if(!function_exists('wangDaRenderImage')){          $app                = JFactory::getApplication();          $template       = $app->getTemplate();          require_once( JPATH_BASE.DS.'templates'.DS.$template.DS.'wangda_functions.php');      }      foreach ($list[$ord]['standard'] as $item){          $big_img = wangDaRenderImage($item, 'home_banner_big_img');          $btn_img = wangDaRenderImage($item, 'home_banner_small_img');                    $i = 0;          foreach($big_img as $img){              $i++;              $big_html .= '';          }            $i = 0;          foreach($btn_img as $img){              $i++;              $btn_html .= '';          }      }        $html = <<<wangDA  {$big_html}{$btn_html}  wangDA;      echo $html;  }      function wangDaRenderImage($item, $fieldsname){      $item = wangDaGetFlexiFeilds($item);        $field = $item->fields[$fieldsname];      $values = $item->fieldvalues[$item->fields[$fieldsname]->id];        $f_params = new JParameter($field->attribs);      $dir          = $f_params->get('dir');      $dir_url      = str_replace('\\','/', $dir);      $images = array();      if( !empty($values) ){          foreach($values as $key => $val){              $value = unserialize($val);              $images[$key]['l'] = $dir_url.'/l_'.$value['originalname'];              $images[$key]['m'] = $dir_url.'/m_'.$value['originalname'];              $images[$key]['s'] = $dir_url.'/s_'.$value['originalname'];              $images[$key]['values'] = $value;          }      }        return $images;  }    function wangDaGetFlexiFeilds($item){      if(!$item->type_id ){          $db = JFactory::getDBO();          $sql = 'SELECT `type_id` FROM #__flexicontent_items_ext WHERE `item_id`='.$item->id;          $db->setQuery($sql);          $item->type_id = $db->loadResult();      }            $items = & FlexicontentFields::getFields($item, 'item');        return $items[0];  }  

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.