<?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 .= '<img src="'.$img['l'].'" border="0"/>';
}
$i = 0;
foreach($btn_img as $img){
$i++;
$btn_html .= '<img src="'.$img['s'].'" border="0"/>';
}
}
$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];
}
joomla2.5 flexicontent 在 flexicontent module 里面获取 image filed 的所有的缩略图方法
最新推荐文章于 2019-07-25 00:35:26 发布