本帖最后由 武当剑客 于 2011-3-25 09:48 编辑
使用方法
1. 模块必须是帖子模块,数据来源必须是高级自定义
2. 必须选择一个且只能选择一个分类信息
3. 在模版中插入 {sort_字段名} 可以调用出相应的字段内容, 插入 {sort_unit_字段名} 可以调用出相应的字段单位
修改方法
--------------------------------------------------
source/function/function_block.php
--------------------------------------------------
1.
找到
- $blockitem['parity'] = $order % 2;
复制代码
替换成:
- $blockitem['parity'] = $order % 2;
- foreach($blockitem['fields'] as $key=>$field) {
- if(substr($key, 0, 5) == 'sort_') {
- $fields[$key] = array();
- }
- }
复制代码
--------------------------------------------------
source/class/block/forum/block_thread.php
--------------------------------------------------
找到
替换为:
- $list[$data['tid']] = array(
复制代码
找到
- 'monthviews' => $data['views']
- )
- );
- }
- $returndata['data'] = $list;
- return $returndata;
- }
复制代码
替换成
- 'monthviews' => $data['views']
- )
- );
-
- $ids[] = $data['tid'];
- }
- $stid = $sortids[0];
- if(!empty($ids)) {
- loadcache(array('threadsort_option_'.$stid));
- $query = DB::query("SELECT * FROM ".DB::table('forum_typeoptionvar')." WHERE tid IN (".dimplode($ids).")");
- while($value = DB::fetch($query)) {
- $arrayoption = $_G['cache']['threadsort_option_'.$stid][$value['optionid']];
- if(in_array($arrayoption['type'], array('radio', 'checkbox', 'select'))) {
- if($arrayoption['type'] == 'checkbox') {
- foreach(explode("\t", $value['value']) as $choiceid) {
- $list[$value['tid']]['fields']['sort_'.$arrayoption['identifier']] .= $arrayoption['choices'][$choiceid].' ';
- }
- } else {
- $list[$value['tid']]['fields']['sort_'.$arrayoption['identifier']] = $arrayoption['choices'][$value['value']];
- }
- } else {
- $list[$value['tid']]['fields']['sort_'.$arrayoption['identifier']] = $value['value'];
- }
- $list[$value['tid']]['fields']['sort_'.$arrayoption['identifier'].'_unit'] = $arrayoption['unit'];
- }
-
- foreach($ids as $key => $value) {
- $listdata[] = $list[$value];
- }
- }
- $returndata['data'] = $listdata;
- return $returndata;
- }
复制代码 |