上次为大家展示了织梦二次开发的联动筛选功能,由于考虑到这个东西的实用性,我再次为大家详细的讲解一遍。
1、需要修改2个php文件,arc.listview.class.php和extend.func.php,这2个文件都是存在于/include/下,提供一个网盘下载地址:http://pan.baidu.com/s/1pJLmEIf
//获得附加表的相关信息!!此段为添加内容!!!by scv dedecms 联动筛选功能
$addtable
=
$this
->ChannelUnit->ChannelInfos[
'addtable'
];
if
(
$addtable
!=
""
)
{
$addJoin
=
" LEFT JOIN `$addtable` ON arc.id = "
.
$addtable
.
'.aid '
;
$addField
=
''
;
$fields
=
explode
(
','
,
$this
->ChannelUnit->ChannelInfos[
'listfields'
]);
foreach
(
$fields
as
$k
=>
$v
)
{
$nfields
[
$v
] =
$k
;
}
if
(
is_array
(
$this
->ChannelUnit->ChannelFields) && !
empty
(
$this
->ChannelUnit->ChannelFields))
{
foreach
(
$this
->ChannelUnit->ChannelFields
as
$k
=>
$arr
)
{
if
(isset(
$nfields
[
$k
]))
{
if
(!
empty
(
$arr
[
'rename'
])) {
$addField
.=
','
.
$addtable
.
'.'
.
$k
.
' as '
.
$arr
[
'rename'
];
}
else
{
$addField
.=
','
.
$addtable
.
'.'
.
$k
;
}
}
}
}
if
(isset(
$_REQUEST
[
'tid'
]))
{
foreach
(
$_GET
as
$key
=>
$value
) {
$filtersql
.= (
$key
!=
"tid"
&&
$key
!=
"TotalResult"
&&
$key
!=
"PageNo"
) ?
" AND $addtable."
.wwwcms_filter(
$key
).
" = '"
.wwwcms_filter(urldecode(
$value
)).
"'"
:
''
;
}
}
}
else
{
$addField
=
''
;
$addJoin
=
''
;
}
//添加内容结束!!!by scv dedecms 联动筛选功能
2、extend.func.php 在其最后面增加如下代码:
01 |
02 |
03 |
04 |
05 |
06 |
07 |
08 |
09 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |