本帖最后由 mpage 于 2010-11-17 15:40 编辑
使用方法
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
--------------------------------------------------
1.
找到
替换成
- $list[$data['tid']] = array(
复制代码
2.
找到
- 'monthviews' => $data['views']
- )
- );
- }
复制代码
替换成
- 'monthviews' => $data['views']
- )
- );
- $ids[] = $data['tid'];
- }
- $stid = $sortids[0];
- if($stid) {
- loadcache(array('threadsort_option_'.$stid));
- $query = DB::query("SELECT * FROM ".DB::table('forum_typeoptionvar')." WHERE tid IN (".dimplode($ids).")");
- while($data = DB::fetch($query)) {
- $arrayoption = $_G['cache']['threadsort_option_'.$stid][$data['optionid']];
- if(in_array($arrayoption['type'], array('radio', 'checkbox', 'select'))) {
- if($arrayoption['type'] == 'checkbox') {
- foreach(explode("\t", $data['value']) as $choiceid) {
- $list[$data['tid']]['fields']['sort_'.$arrayoption['identifier']] .= $arrayoption['choices'][$choiceid].' ';
- }
- } else {
- $list[$data['tid']]['fields']['sort_'.$arrayoption['identifier']] = $arrayoption['choices'][$data['value']];
- }
- } else {
- $list[$data['tid']]['fields']['sort_'.$arrayoption['identifier']] = $data['value'];
- }
- $list[$data['tid']]['fields']['sort_'.$arrayoption['identifier'].'_unit'] = $arrayoption['unit'];
- }
- }
复制代码
|