dedecms,织梦,织梦伪静态规则,织梦全站伪静态,织梦手机版伪静态,vultr云服务器,vultr优惠,vultr教程,vultr购买

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

织梦教程 baishitou 127℃

织梦DEDECMS多城市分站站群插件,无需修改模板无需生成分站,支持增删改查城市,伪静态实现多城市分站

插件预览

1-210509203R61S

1-210509222FU96

1-210509220241213

插件特色

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

使用说明

1、文末下载插件,解压。网站后台-模块-上传新模块,安装

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'];

4、打开 /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全国城市模板文件

<!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-210509223210604

全部完成后,打开 http://你的域名/areas.html  查看全国城市页面

1-210509222FU96

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

1-21050921532N59

特别说明

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

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

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

主站默认效果如下

1-210512221451304

分站效果如下

1-210512221J5158

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

1-210512222110196

插件下载

 

本文来源:https://www.dedehtml.com/plugin/dede-areas.html

喜欢 (0)or分享 (0)