网站地图    收藏   

主页 > 前端 > css教程 >

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

来源:自学PHP网    时间:2015-04-14 14:51 作者: 阅读:

[导读] ?php defined(#39;_JEXEC#39;) or die(#39;Restricted access#39;); foreach ($ordering as $ord){ if (!isset($list[$ord][#39;standard#39;])) { ......

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

 

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论