zoukankan      html  css  js  c++  java
  • 织梦地区联动在当前页面title加入选择的地区名

    织梦分类信息模型在列表页选择地区联动时,想要在<title>北京市东城区学院 - 我的网站</title>或者<title>广东省广州市白云区学院_我的网站</title>

    效果展示

    修改教程

    分类信息模型 的话从第1步开始,其他模型从第2步开始

    1、打开 include/arc.sglistview.class.php 找到

    $this->Fields['typeid'] = $this->TypeID;

    在它的下面加入

    $this->Fields['nativeplace'] = $this->searchArr['nativeplace'];

    其他模型 (文章模型、图集模型、软件模型、商品模型) 不需要加第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 `#@_sys_enum` where egroup='".$egroup."' and evalue='".$evalue."'");
                return $rowtop['ename'];
            }
            else
            {
                (preg_match("#.#", $evalue)) ? $rowre = $dsql->GetOne("select ename from `#@_sys_enum` where egroup='".$egroup."' and evalue='".( floor($evalue-($evalue%500))+1 )."'") : $rowre['ename'] = '';
                $rowtop = $dsql->GetOne("select ename from `#@_sys_enum` where egroup='".$egroup."' and evalue='".( floor($evalue-($evalue%500)) )."'");
                $rowson = $dsql->GetOne("select ename from `#@_sys_enum` where egroup='".$egroup."' and evalue='".$evalue."'");
                if(is_array($rowson))
                {
                    return $rowtop['ename'].$rowre['ename'].$rowson['ename'];
                }
            }
        }
    }

    列表模板title处的标签写法

    <title>{dede:field.nativeplace function=GetSysEnum(@me)/}</title>
  • 相关阅读:
    Elasticsearch集群优化实战
    Elasticsearch跨集群搜索(Cross Cluster Search)
    Elasticsearch集群运维
    Elasticsearch冷热集群搭建
    分布式系统事务一致性
    使用Vertx重构系统小结
    ThreadLocal原理分析与使用场景
    使用Vertx构建微服务
    使用 Python & Flask 实现 RESTful Web API
    Golang简单工厂方法demo
  • 原文地址:https://www.cnblogs.com/dedehtml/p/9901284.html
Copyright © 2011-2022 走看看