// 列表-官方发布 $list_gffb = jointGetRecommenList($cfg_portal_recommen_gf); // 列表-攻略 $list_gl = jointGetRecommenList($cfg_portal_recommen_gl); // 列表-活动专区 $list_hdzq = jointGetRecommenList($cfg_portal_recommen_hd); // 列表-知性男女 $list_zxnn = jointGetRecommenList($cfg_portal_recommen_zx); // 查询推荐信息 $recommen_1 = jointGetRecommenList($cfg_portal_recommen_1); // 查询推荐信息 $recommen_2 = jointGetRecommenList($cfg_portal_recommen_2); */ $recommen_1 = jointGetRecommenList($cfg_portal_recommen_1); // 板块热门文章 $hot = jointGetHotList(array(181, 182, 183, 184)); // 我关注的板块 $follow_forum = jointGetFollowForum($_G['uid']); // 未读消息 $message_num = jointGetWeiduMessage($_G['uid']); $unreadthread = jointGetUnreadthread($_G['uid']); // 个人信息 $_G['member']['username'] = jointGetJfNiceByUsername($_G['member']['username']); $value2['head'] = jointGetPhoto($_G['uid'], $url = 1); include template('jointapp/portal');
<?php /** * 根据type返回推荐信息,json格式 **/ $type = jointFlushStr($_REQUEST['type']); // 得到所有的推荐数据 $arr = jointGetRecommenList($type); // 取出来有用的信息 $usearr = array(); foreach ($arr as $k => $v) { $data = array(); $data['title'] = $v['title']; $data['ctime'] = $v['oth_2']; $data['url'] = $cfg_siteurl . $v['url']; $usearr[] = $data; } $usestr = array_to_json($usearr); print_r($usestr); exit; function array_to_json($array) { if (!is_array($array)) { return false; } $associative = count(array_diff(array_keys($array), array_keys(array_keys($array)))); if ($associative) { $construct = array(); foreach ($array as $key => $value) { // We first copy each key/value pair into a staging array, // formatting each key and value properly as we go.