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>
  • 相关阅读:
    Visual Studio开启SSL的支持
    Linux下ls命令使用详解(转)
    Linux下which命令使用详解(转)
    SQLServer出现不允许保存更改的问题解决
    Mac下包管理平台homebrew的使用
    Jenkins使用FTP进行一键部署及回滚2(Windows)(项目实践)
    TGI
    房地产 专题
    Anaconda
    推荐《用Python进行自然语言处理》中文翻译-NLTK配套书
  • 原文地址:https://www.cnblogs.com/dedehtml/p/9901284.html
Copyright © 2011-2022 走看看