joomla2.5 flexicontent 在 flexicontent module 里面获取 i

 
<?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];  
}  

 

返回顶部
跳到底部

Copyright 2011-2024 南京追名网络科技有限公司 苏ICP备2023031119号-6 乌徒帮 All Rights Reserved Powered by Z-BlogPHP Theme By open开发

请先 登录 再评论,若不是会员请先 注册