本文整理汇总了PHP中gcms::sortby方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::sortby方法的具体用法?PHP gcms::sortby怎么用?PHP gcms::sortby使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::sortby方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$search_result[$i]['category_id'] = gcms::getVars($item, 'category_id', 0);
$search_result[$i]['topic'] = $item['topic'];
$search_result[$i]['alias'] = $item['alias'];
$search_result[$i]['index'] = $item['index'];
if ($item['description'] == '') {
$search_result[$i]['detail'] = gcms::cutstring(gcms::html2txt($item['detail']), 149);
} else {
$search_result[$i]['detail'] = $item['description'];
}
$search_result[$i]['module'] = $item['module'];
$search_result[$i]['owner'] = $item['owner'];
$search_result[$i]['value'] = $v * ($item['level'] + $item['index']);
}
if (sizeof($search_result) > 0) {
// เรียงลำดับผลลัพท์ตาม score
gcms::sortby($search_result, 'value', false);
// จัดรูปแบบข้อความ
$searchitem = gcms::loadtemplate('search', 'search', 'searchitem');
$match = array('/{URL}/', '/{TOPIC}/', '/{DETAIL}/', '/{LINK}/');
foreach ($search_result as $item) {
unset($data);
if ($item['owner'] == 'index' || $item['index'] == 1) {
$url1 = gcms::getURL($item['module']);
$url2 = gcms::getURL($item['module'], '', 0, 0, '', false);
} elseif ($item['owner'] == 'board') {
$url1 = gcms::getURL($item['module'], '', 0, 0, "wbid={$item['id']}");
$url2 = $url1;
} elseif ($item['owner'] == 'document') {
if ($config['module_url'] == 1) {
$url1 = gcms::getURL($item['module'], $item['alias'], 0, 0, 'q=' . urlencode($search), true);
$url2 = gcms::getURL($item['module'], $item['alias'], 0, 0, '', false);
示例2: empty
} else {
$datas[$k]['total'] = empty($datas[$k]['total']) ? 1 : $datas[$k]['total'] + 1;
}
}
}
if ($ip == '') {
if ($type == 'ip') {
// เรียงลำดับตาม ip
gcms::sortby($datas, 'ip');
} else {
// เรียงลำดับตาม referer
gcms::sortby($datas, 'referer');
}
} else {
// เรียงลำดับตาม time
gcms::sortby($datas, 'time');
}
$graphs['Google Search'] = 0;
$graphs['Google Cached'] = 0;
$graphs['Inbound'] = 0;
$graphs['Direct'] = 0;
$graphs['Direct'] = 0;
$graphs['other'] = 0;
$list = array();
$total = 0;
$i = 0;
$bg = 'bg2';
foreach ($datas as $item) {
$i++;
if (isset($item['total'])) {
$total = $total + $item['total'];