互联网知识

精准传达 • 价值共享

洞悉互联网前沿资讯,探寻网站营销规律

查看其它板块

织梦DEDECMS多城市分站站群插件

作者:狐灵科技 | 2021-06-02 22:43 |点击:

分站插件特点:无需修改模板无需生成分站,支持增删改查城市,伪静态实现多城市分站

织梦DEDECMS多城市分站站群插件





插件特色

  • 无需生成任何文件,伪静态实现多城市分站
  • 后台城市管理自由增删改查,无限级城市分类
  • 无需修改现有模板文件

使用说明

1、文末下载插件,解压。网站后台-模块-上传新模块,安装(注意插件安装的时候php版本不能过高 5.6以下)

2、根据自己主机web环境添加伪静态规则

nginx

rewrite ^/areas_([a-z]+)/(.*)/([0-9]+).html$ /areas/plus/view.php?aid=$3&area=$1 last;
rewrite ^/areas_([a-z]+)/(.*)/([0-9]+)_([0-9]+).html$ /areas/plus/view.php?aid=$2&pageno=$3&area=$1 last;
rewrite ^/areas_([a-z]+)/(.*)/$ /areas/plus/list.php?tid=$2&area=$1 last;
rewrite ^/areas_([a-z]+)/(.*)/list_([0-9]+)_([0-9]+).html$ /areas/plus/list.php?tid=$2&PageNo=$4&area=$1 last;
rewrite ^/areas_([a-z]+)/$ /areas/index.php?area=$1 last;
rewrite ^/areas.html$ /areas/index.php last;

apache

RewriteEngine On
RewriteBase /
RewriteRule ^areas_([a-z0-9_-]+)/(.*)/([0-9]+).html$ areas/plus/view.php?aid=$3&area=$1 [L]
RewriteRule ^areas_([a-z0-9_-]+)/(.*)/([0-9]+)_([0-9]+).html$ areas/plus/view.php?aid=$2&pageno=$3&area=$1 [L]
RewriteRule ^areas_([a-z0-9_-]+)/(.*)/$ areas/plus/list.php?tid=$2&area=$1 [L]
RewriteRule ^areas_([a-z0-9_-]+)/(.*)/list_([0-9]+)_([0-9]+).html$ areas/plus/list.php?tid=$3&PageNo=$4&area=$1 [L]
RewriteRule ^areas_([a-z0-9_-]+)/$ areas/index.php?area=$1 [L]
RewriteRule ^areas.html$ areas/index.php [L]

 

iis7+

<rule name="分站文章页">
	<match url="^areas_([a-z]+)/(.*)/([0-9]+).html$" ignoreCase="false" />
	<action type="Rewrite" url="/areas/plus/view.php?aid={R:3}&amp;area={R:1}" appendQueryString="false" />
</rule>
<rule name="分站文章分页">
	<match url="^areas_([a-z]+)/(.*)/([0-9]+)_([0-9]+).html$" ignoreCase="false" />
	<action type="Rewrite" url="/areas/plus/view.php?aid={R:2}&amp;pageno={R:3}&amp;area={R:1}" appendQueryString="false" />
</rule>
<rule name="分站栏目页">
	<match url="^areas_([a-z]+)/(.*)/$" ignoreCase="false" />
	<action type="Rewrite" url="/areas/plus/list.php?tid={R:2}&amp;area={R:1}" appendQueryString="false" />
</rule>
<rule name="分站栏目分页">
	<match url="^areas_([a-z]+)/(.*)/list_([0-9]+)_([0-9]+).html$" ignoreCase="false" />
	<action type="Rewrite" url="/areas/plus/list.php?tid={R:3}&amp;PageNo={R:4}&amp;area={R:1}" appendQueryString="false" />
</rule>
<rule name="分站首页">
	<match url="^areas_([a-z]+)/$" ignoreCase="false" />
	<action type="Rewrite" url="/areas/index.php?area={R:1}" appendQueryString="false" />
</rule>
<rule name="分站全国">
	<match url="^areas.html$" ignoreCase="false" />
	<action type="Rewrite" url="/areas/index.php" appendQueryString="false" />
</rule>

 

3、打开 /include/arc.archives.class.php 找到

$preRow = $this->dsql->GetOne($query.$pre);

在它下面加入

if(is_array($preRow)) $preRow['title'] = $GLOBALS['cfg_areas_title'] . $preRow['title'];
if(is_array($nextRow)) $nextRow['title'] = $GLOBALS['cfg_areas_title'] . $nextRow['title'];


打开 /include/arc.listview.class.php 找到

function Display()

 

改成

function Display($ismake=0)

 

继续找到

$this->ParseDMFields($this->PageNo,0);

改成

$this->ParseDMFields($this->PageNo,$ismake);

继续找到

//处理一些特殊字段

在它上面加入

$row['title'] = $GLOBALS['cfg_areas_title'] . $row['title'];

 

继续找到

$row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif';

改成

$row['litpic'] = $GLOBALS['cfg_basehost'].'/images/defaultpic.gif';

5、打开 /include/typelink.class.php 找到

$this->TypeInfos = $this->dsql->GetOne($query);

在它下面加入

$this->TypeInfos['typename'] = $GLOBALS['cfg_areas_title'] . $this->TypeInfos['typename'];

 

继续找到

$tinfos = $this->dsql->GetOne();

在它下面加入

$tinfos['typename'] = $GLOBALS['cfg_areas_title'] . $tinfos['typename'];

6、打开 /include/taglib/arclist.lib.php 找到

//处理一些特殊字段

在它上面加入

$row['title'] = $GLOBALS['cfg_areas_title'] . $row['title'];

 

7、打开 /include/taglib/channel.lib.php 找到

$row['sonids'] = $row['rel'] = '';

在它上面加入

$row['typename'] = $GLOBALS['cfg_areas_title'] . $row['typename'];

8、打开 /include/taglib/channelartlist.lib.php 找到

$pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]);

在它下面加入

$pv->Fields['typename'] = $GLOBALS['cfg_areas_title'] . $typeids[$i]['typename'];

9、打开 /include/taglib/type.lib.php 找到

$row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);

上面加入

$row['typename'] = $GLOBALS['cfg_areas_title'] . $row['typename'];

到这里后 需要修改的文件全部修改完毕  以下是调用标签 可供参考

 

10、在你网站模板里任意地方可以加入调用输出你想要的地区名称和链接
 

{dede:areas sqlstr="" row="5"}
<dt>
	<a href='[field:arcurl/]'>[field:title/]</a>
</dt>
<dd>
	[field:sonareas1]
	<a href='[field:arcurl/]'>[field:title/]</a>
		[field:sonareas2]
		<a href='[field:arcurl/]'>[field:title/]</a>
		[/field:sonareas2]
	[/field:sonareas1]
</dd>
{/dede:areas}

 

调用一级地区

{dede:areas sqlstr="" row="5"}{/dede:areas}

调用一级和二级地区

{dede:areas sqlstr="istop = 1" row="5"}
    [field:sonareas1][/field:sonareas1]
{/dede:areas}

调用一级、二级、三级地区

{dede:areas sqlstr="istop = 1" row="5"}
    [field:sonareas1]
        [field:sonareas2][/field:sonareas2]
    [/field:sonareas1]
{/dede:areas}

调用推荐的地区

sqlstr="istop = 1"

调用地区个数

row="5"

 

11、在自己模板文件夹里新建一个areas.htm全国城市模板文件
 

如图

 




 

 

  1. <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>全国城市分站</title>
    </head>
    <body>
    <!--可以引入自己的头部和尾部-->
    <style>
    .all_city{clear:both;max-width:1200px;margin:0 auto}
    .all_city h2{padding:0;margin:0;font-size:16px;font-weight:700;width:70px;color:#00a0e9;line-height:30px}
    .all_city h2 a{text-decoration:none;font-size:16px;font-weight:700;width:70px;color:#222;line-height:30px}
    .all_city ul{padding:0;margin:0;list-style:none;float:left;padding-left:20px}
    .all_city ul li.all_city_li{clear:both;float:left;line-height:30px}
    .all_city ul.all_city_ul li{list-style:none;float:left}
    .all_city ul li.all_city_li a,.all_city ul.all_city_ul li a{display:block;float:left;padding-left:10px;color:#222;text-decoration:none;font-size:14px}
    </style>
    {dede:areas}
    <div class="all_city">
        <h2><a href='[field:arcurl/]'>[field:title/]</a></h2>
        <ul>
            [field:sonareas1]
            <li class="all_city_li">
                <a href='[field:arcurl/]'><b>[field:title/]</b></a>
                <ul class="all_city_ul">
                    [field:sonareas2]
                    <li><a href='[field:arcurl/]'>[field:title/]</a></li>
                    [/field:sonareas2]
                </ul>
            </li>
            [/field:sonareas1]
        </ul>
    </div>
    {/dede:areas}
    </body>
    </html>

 


核心的代码主要是红色的部分  样式可以自己写


 

或者参考我这边写的样式代码

 

  1. <style type="text/css">
    .hlwlcity{position:relative;margin-bottom:20px;border:1px solid #ddd;padding:15px 10px 10px;font-size:0}
    .hlwlcity a:hover{color:#d90000}
    .hlwlcity .one{position:absolute;left:10px;top:-19px;padding:5px;background:#fff;color:#d90000;font-size:16px;font-weight:bold}
    .hlwlcity .two{display:inline-block;vertical-align:top;*display:inline;*zoom:1;width: 10%;font-size:14px;line-height:32px;padding-left:5px;}
    .hlwlcity .two dt:before{content:'';display:inline-block;vertical-align:top;*display:inline;*zoom:1;width:4px;height:4px;margin-top:14px;background:#d90000;margin-right:5px}
    .hlwlcity .two dd{padding-bottom:5px}
    .hlwlcity .thr a{display:block;font-size:13px;line-height:30px;padding-left:12px}
    </style>
     
     
     
    {dede:areas}
    <div class="hlwlcity">
    <h3 class="one"><a href="[field:arcurl/]">[field:title/]</a></h3>
       [field:sonareas1]
      <dl class="two"><dt><a href="[field:arcurl/]">[field:title/]</a></dt></dl>
    [field:sonareas2]
    <dl class="two"><dt><a href="[field:arcurl/]">[field:title/]</a></dt></dl>
       [/field:sonareas2]
      [/field:sonareas1]
    </div>   
    {/dede:areas} 
     
 
全部完成后,打开 http://你的域名/areas.html  查看全国城市页面

11、后台-系统-系统基本参数可以开启和关闭分站独立SEO信息

 

特别说明

如果你主站有城市地区名的地方,在分站想跟随分站更换城市名话,可以用这个标签来

{dede:global.cfg_areas_title runphp=yes}@me = @me ? @me : '包头';{/dede:global.cfg_areas_title}

主站默认显示为包头XXX,分站时显示当前城市名

主站默认效果如下

分站效果如下

head.htm 头部模板里的写法示例


 

插件下载

织梦多城市分站站群插件

如没特殊注明,文章均为狐灵科技原创,转载请注明  https://www.hulingweb.cn/hulianwang/8874.html
多一份免费策划方案,总有益处。

请直接添加技术总监微信联系咨询

网站设计 品牌营销

多一份参考,总有益处

联系狐灵科技,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:023-68168040 / 大客户专线:15523356218