帝国cms教程:结合项开发分类筛选的操作方法

2020-07-2410:20:15网站建设与开发Comments2,905 views字数 4023阅读模式

1、肯定要从后台添加相关的字段(如何添加这种问题就不说了)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

帝国cms教程:结合项开发分类筛选的操作方法文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

从最后选中结合向的选项。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

2、从帝国cms的 userfun.php 函数中,增加下方代码文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

1
2
3
4
5
6
7
8
9
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
function user_ShowFieldandChange($ecms=0){
    global $public_r;
    //------- 函数参数设置开始 -----
    //要显示的结合项字段列表,多个字段用半角逗号“,”隔开
    $fieldandvar='qyfl,hyyy';
    //字段显示选项设置,多项用双“#”号隔开,格式:选项说明|==|内容1,值1##内容2,值2
    $fieldandval=array();
    $fieldandval['qyfl']='地区:|==|不限,##北京,北京市##天津,天津##河北,河北##山西,山西##内蒙古,内蒙古##河南,河南##山东,山东##陕西,陕西##辽宁,辽宁##吉林,吉林##黑龙江,黑龙江##甘肃,甘肃##宁夏,宁夏##新疆,新疆##青海,青海##上海,上海##浙江,浙江##江苏,江苏##广东,广东##广西,广西##湖南,湖南##湖北,湖北##四川,四川##重庆,重庆##福建,福建##安徽,安徽##江西,江西##贵州,贵州##云南,云南##海南,海南';
    $fieldandval['hyyy']='行业应用: |==|不限,##政府,政府##公检法,公检法##部队,部队##监狱,监狱##企业,企业##交通,交通##石化,石化';
    //正常链接样式
    $fieldandcss='fieldandcss';
    //已选的选项链接样式
    $changefieldandcss='changefieldandcss';
    //字段与字段的显示间隔符,格式:开始显示字符|结束显示字符
    $fieldexp='<div class="caseB">|</div>';
    //选项与选项的显示间隔符,格式:开始显示字符|结束显示字符
    $valexp='|';
    //------- 函数参数设置结束 -----
    $userfunecmsver=function_exists('ehtmlspecialchars')?1:0;
    //附加参数
    $urlcs='';
    $mid=(int)$_GET['mid'];
    if($mid)
    {
        $urlcs.='&mid='.$mid;
    }
    if($_GET['classid'])
    {
        $classid=RepPostVar($_GET['classid']);
        $urlcs.='&classid='.$classid;
    }
    else
    {
        if(!$_GET['mid']&&!$_GET['ttid']&&!$_GET['ztid'])
        {
            $classid=intval($GLOBALS['navclassid']);
            $urlcs.='&classid='.$classid;
        }
    }
    if($_GET['ttid'])
    {
        $ttid=RepPostVar($_GET['ttid']);
        $urlcs.='&ttid='.$ttid;
    }
    if($_GET['ztid'])
    {
        $ztid=RepPostVar($_GET['ztid']);
        $urlcs.='&ztid='.$ztid;
    }
    if($_GET['firsttitle'])
    {
        $firsttitle=(int)$_GET['firsttitle'];
        $urlcs.='&firsttitle='.$firsttitle;
    }
    if($_GET['isgood'])
    {
        $isgood=(int)$_GET['isgood'];
        $urlcs.='&isgood='.$isgood;
    }
    if($_GET['endtime'])
    {
        $starttime=RepPostVar($_GET['starttime']);
        $endtime=RepPostVar($_GET['endtime']);
        $urlcs.='&starttime='.$starttime.'&endtime='.$endtime;
    }
    $line=(int)$_GET['line'];
    if($line)
    {
        $urlcs.='&line='.$line;
    }
    $tempid=(int)$_GET['tempid'];
    if($tempid)
    {
        $urlcs.='&tempid='.$tempid;
    }
    if($_GET['orderby'])
    {
        $orderby=RepPostVar($_GET['orderby']);
        $myorder=(int)$_GET['myorder'];
        $urlcs.='&orderby='.$orderby.'&myorder='.$myorder;
    }
    //间隔字符
    $fieldexpr=explode('|',$fieldexp);
    $valexpr=explode('|',$valexp);
    //输出选项
    $fr=explode(',',$fieldandvar);
    $fcount=count($fr);
    $allstr='';
    $urladd='';
    for($i=0;$i<$fcount;$i++)
    {
        $field=$fr[$i];
        //选项链接
        $getval='';
        if($_GET[$field])
        {
            $getval=$userfunecmsver==1?ehtmlspecialchars($_GET[$field],ENT_QUOTES):htmlspecialchars($_GET[$field],ENT_QUOTES);
            $urladd.='&'.$field.'='.urlencode($getval);
        }
        //选项说明
        $vsayr=explode('|==|',$fieldandval[$field]);
        //选项内容
        $valallstr='';
        $vr=explode('##',$vsayr[1]);
        $vcount=count($vr);
        for($vi=0;$vi<$vcount;$vi++)
        {
            $vtr=explode(',',$vr[$vi]);
            if($getval==$vtr[1])
            {
                $css=$changefieldandcss;
            }
            else
            {
                $css=$fieldandcss;
            }
            $valallstr.=$valexpr[0].'<a href="'.$public_r['newsurl'].'e/action/ListInfo.php?'.$urlcs.'&ph=1<!--url.add-->&'.$field.'='.urlencode($vtr[1]).'" class="'.$css.'">'.$vtr[0].'</a>'.$valexpr[1];
        }
        $allstr.=$fieldexpr[0].$vsayr[0].$valallstr.$fieldexpr[1];
    }
    $allstr=str_replace('<!--url.add-->',$urladd,$allstr);
    echo $allstr;
}

代码中有几个属性注意一下。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

3、然后从前台想要添加筛选的位置添加下方代码文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

1
<?=user_ShowFieldandChange()?>

就是非常简单的引用userfun.php文件中写的函数名即可。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

4、弄完之后就是下方的效果了文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

帝国cms教程:结合项开发分类筛选的操作方法文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/19780.html

  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/cms/19780.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定