织梦地区联动在当前页面title加入选择的地区名
dedeCMS教程
2019-08-22 15:26:24
463
织梦分类信息模型在列表页选择地区联动时,想要在<title>北京市东城区学院 - 我的网站</title>或者<title>广东省广州市白云区学院_我的网站</title>
效果展示
修改教程
分类信息模型 的话从第1步开始,其他模型从第2步开始
1、打开 include/arc.sglistview.class.php 找到
$$this->Fields['typeid'] = $$this->TypeID;
- 1
在它的下面加入
$$this->Fields['nativeplace'] = $$this->searchArr['nativeplace'];
- 1
其他模型 (文章模型、图集模型、软件模型、商品模型) 不需要加第1步
2、打开 include/extend.func.php 在最下面增加个方法
if(!function_exists('GetSysEnum'))
{
function GetSysEnum($$evalue, $$egroup)
{
global $$dsql;
$$evalue = trim(ltrim($$evalue, ","));
$$egroup = isset($$egroup) ? $$egroup : 'nativeplace';
if($$evalue % 500 == 0)
{
$$rowtop = $$dsql->GetOne("select ename from `xjq_sys_enum` where egroup='".$$egroup."' and evalue='".$$evalue."'");
return $$rowtop['ename'];
}
else
{
(preg_match("#.#", $$evalue)) ? $$rowre = $$dsql->GetOne("select ename from `xjq_sys_enum` where egroup='".$$egroup."' and evalue='".( floor($$evalue-($$evalue%500))+1 )."'") : $$rowre['ename'] = '';
$$rowtop = $$dsql->GetOne("select ename from `xjq_sys_enum` where egroup='".$$egroup."' and evalue='".( floor($$evalue-($$evalue%500)) )."'");
$$rowson = $$dsql->GetOne("select ename from `xjq_sys_enum` where egroup='".$$egroup."' and evalue='".$$evalue."'");
if(is_array($$rowson))
{
return $$rowtop['ename'].$$rowre['ename'].$$rowson['ename'];
}
}
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
列表模板title处的标签写法
<title>{dede:field.nativeplace function=GetSysEnum(@me)/}</title>
织梦dedecms联动类型地区联动及省份-市级-地区分开+高亮