专注前端,专注网页设计分享 - (网页制作/模板制作/设计)755150799 织梦模板 | 网页特效 | 网站模板 | 建站教程 | Tag标签 | 联系站长

织梦多城市分站站群插件,dedecms城市分站伪静态插件

时间:2022-01-19 16:43:52来源:学技巧网站制作 作者:学技巧 阅读:0次 【 点评一下

织梦多城市分站站群插件,dedecms城市分站伪静态插件,这是根据大神春哥的教程,仅作个人学习之用。

先给大家看看安装后后台的显示效果:

image

每个地区都可以单独定义的

image

系统参数:

image


下面是使用教程:


根据自己主机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]

 

打开 /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'];

1642574918(1)

1642574933(1)1642574946(1)

调用一级地区

{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"

 

在自己模板文件夹里新建一个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>

 

 1642574972(1)

 

关于城市分站安装之后,内容页跳转到404的问题:


根据栏目的文章命名规则进行修改:

插件安装完之后,在根目录有一个文件夹:areas\plus

view.php

 1642575006(1)

如图画红线部分,$aid = substr($aid, 6);

数字6可以根据自身命名规则进行改变,可以是2345

 

 

Dedecms后台程序不建议使用dede58的,如果使用建议注释掉(删除)一部位代码。

dede58添加了子目录设置

找到文件:

include/arc.listview.class.php

1642575022(1)

1642575035(1)

一共有两处需要删除或注释。

 

\include\taglib\arclist.lib.php

1642575053(1)

也需要注释掉。

 

PS:注释掉这些代码是因为在伪静态,给调用缩略图的文章列表,url地址不对,会自动加上当前城市名称,导致图片URL地址不正确。

 

具体详情和插件下载移步:

https://pan.baidu.com/s/11JTadHezWidIv7sQ3r963A


  • 用微信  “扫一扫”

    将文章分享到朋友圈。

    关注公众号:xue-jiqiao

本文版权归原作者所有,转载请注明原文来源出处,学技巧网站制作感谢您的支持!