织梦多城市分站站群完整代码 文末下载完整版
1、系统设置:
核心设置—— 是否使用伪静态:是
其他选项—— 模板引擎禁用标签:清空
性能选项—— arclist标签调用缓存:0
2、后台-系统-SQL命令行工具中执行两语句:
(1)将所有文档设置为仅动态浏览
update dede_archives set ismake=-1
(1)将所有栏目设置为使用动态页
update dede_arctype set isdefault=-1
3、上传整个mycity文件夹和.htaccess文件到根目录;把根目录下的dede后台管理文件和include两个文档打开,把对应的文件放进对应修改的文件;
---这里是注解文件作用----
/include/helpers/
-----channelunit.helper.php //伪静态设置
/include/
----arc.archives.class //上一篇下一篇
----arc.listview.class.php //文章分页
----arc.taglist.class.php //标签分页
----typelink.class.php //当前位置
/include/taglib/
----arclist.lib.php //分页
----channel.lib.php //导航
----tag.lib.php //标签
-----文件注解------根据自己服务器设置静态文件,不然页面会打开错误
.htaccess 是Apache的静态文件
bcloud_nginx_user.conf是百度云主机的静态文件
Nginx.txt 是linux宝塔的伪静态文件
web.config 是IIS的静态文件
4、设置站点
修改主目录/mycity文件下index.php 第4行 $weblink = 'www.xxx.com' //你自己的域名
-----------5、织梦二次开发模板调用说明-----------
这里跟后台模板修改说明书.txt是一样,这里就大概说明一下!具体可以看修改说明书!
在需要添加分站的模板<head>和</head>之间添加以下代码,一定要添加不然城市名不会显示
{dede:php}require (DEDEROOT.'/mycity/index.php');{/dede:php} 这里是注解//模板引用城市
(1)主页模板标题改为
{dede:php}echo constant("title");{/dede:php}
格式:'分站 站群' => '北京分站|北京站群'
(2)主页模板关键词改为
{dede:php}echo constant("keywords");{/dede:php}
格式:'分站,站群' => '北京分站,北京站群'
(3)主页模板描述改为
{dede:php}echo constant("city");{/dede:php}{dede:global.cfg_description/}
(4)菜单栏目或者列表前添加调用城市名称代码
{dede:php}echo constant("city");{/dede:php}
栏目的URL改为[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html
(5)列表文章名称前添加城市名称代码
[field:city runphp='yes']@me=constant('city');[/field:city] 这里是注解//城市名称
文章URL改为[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/view-[field:id/].html
(6)栏目模板title、description、keywords添加城市调用代码
{dede:php}echo constant("city");{/dede:php}
(7)全国城市
{dede:php}echo constant("link");{/dede:php}
(8)城市列表
{dede:php}echo constant("links");{/dede:php}
(9)调用不同列表、内容示例
文章:
{dede:arclist keyword='1'}
<a href="url">[field:city runphp="yes"]@me=constant("city");[/field:city]文章标题</a>
{/dede:arclist}
列表:
{dede:list pagesize='12' keyword='1'}
<a href="url">[field:city runphp="yes"]@me=constant("city");[/field:city]分页文章标题</a>
{/dede:list}
文章标题和url
<a href="[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/view-[field:id/].html">[field:city runphp='yes']@me=constant('city');[/field:city][field:title/]</a>
图片链接示例
<a href="[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/view-[field:id/].html" title="[field:city runphp='yes']@me=constant('city');[/field:city][field:title /]"><img src="[field:picname/]" alt="[field:title /]" width="220" height="134" /></a>
在需要显示城市名的地方插入以下代码中的一项,有两种展示形式,
(1)全国分类城市展示
{dede:php}echo constant("link");{/dede:php}
(2)城市全部列表
{dede:php}echo constant("links");{/dede:php}
---------------头部显示分站插入地方的代码--------------------------------------------------------------
<i style="margin-left: 1px;color: orange;">✥</i><span style="background: #004b92;padding: 0 10px;border-radius: 5px;line-height: 20px;margin-top: 5px;color: #f9f6f6;">全国分站</span> <a href="http://xxx/list-xx.html">[切换城市]</a>
当前位置:
{dede:field name='position' runphp='yes'}
$st=split(' > ',@me);
$l = '';
foreach ($st as $v) {
$s = split("'>",$v);
if($s['1']){
$l.= $s['0']."'>".city.$s['1']." > ";
}
}
@me=$l;
{/dede:field}
补充一下部分网站导航顶级栏目分站插入代码只供参考
<li><a href="/">首页</a></li>
{dede:channelartlist row=10 typeid='top'}
<li><a href="{dede:type typeid ='' }[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html{/dede:type}">{dede:field name='typename'/}</a>
<ul class="sub-menu">
{dede:channel type='son' noself='yes'}
<li><a href="[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html">[field:city runphp='yes']@me=constant('city');[/field:city][field:typename/]</a></li>
{/dede:channel}
</ul>
</li>
{/dede:channelartlist}
这里注意讲的是后台模板代码的修改说明书,不懂的多看几遍
一、模板目录下的主页index.htm修改
1、在修改的模板<head>和</head>之间添加以下代码,一定要添加不然城市名不会显示
{dede:php}require (DEDEROOT.'/mycity/index.php');{/dede:php} //模板引用城市分站
2、TDK标题、关键词、描述、分别改为
<title>{dede:php}echo constant("title");{/dede:php}</title>
<meta name="description" content="{dede:php}echo constant("city");{/dede:php}{dede:global.cfg_description/}" />
<meta name="keywords" content="
{dede:php}echo constant("keywords");{/dede:php}" />
3、栏目名称和URL修改:
1)、在所有[field:typename/]前面添加[field:city runphp='yes']@me=constant('city');[/field:city]
2)、所有栏目URL[field:typelink /]改成[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html
例子:<div class="module-full-screen-more">{dede:type typeid='6'}<a href="[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html" target="_blank">更多</a>{/dede:type}</div>
4、文章标题和URL修改:
1)、在所有[field:title/]前面添加[field:city runphp='yes']@me=constant('city');[/field:city]
2)、文章URL所有[field:arcurl/]改为[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/view-[field:id/].html
例子:<h2><a href="[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/view-[field:id/].html" target="_blank">[field:city runphp='yes']@me=constant('city');[/field:city][field:title/]</a></h2>
二、头部head.htm导航修改
参照代码
{dede:channelartlist row=10 typeid='top'}
<li {dede:field name='currentstyle'/}><a class="first-level" href="{dede:type typeid ='' }[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html{/dede:type}" target=""><strong>{dede:field name='typename'/}</strong></a><i></i>
<div class="vertical-nav-bg"></div>
<ul class="">
{dede:channel type='son' noself='yes'}
<li><a href="[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html">[field:city runphp='yes']@me=constant('city');[/field:city][field:typename/]</a></li>
{/dede:channel}
三、产品图片栏目list_image.htm模板修改
1、在修改的模板<head>和</head>之间添加以下代码
{dede:php}require (DEDEROOT.'/mycity/index.php');{/dede:php} //模板引用城市
2、在原来的TDK前分别添加城市名称调用代码{dede:php}echo constant("city");{/dede:php}
如:<title>{dede:php}echo constant("city");{/dede:php}{dede:field.title/}_{dede:global.cfg_webname/}</title>
<meta name="keywords" content="{dede:php}echo constant("city");{/dede:php}{dede:field name='keywords'/}" />
<meta name="description" content="{dede:php}echo constant("city");{/dede:php}{dede:field name='description' function='html2text(@me)'/}" />
3、栏目名称和URL修改:
1)、在所有栏目名称[field:typename/]前面添加[field:city runphp='yes']@me=constant('city');[/field:city]
2)、所有栏目UR[field:typelink /]改成[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html
例子:<li><a href="[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/list-[field:id/].html">[field:city runphp='yes']@me=constant('city');[/field:city][field:typename/]</a></li>>
4、文章标题和URL修改:
1)、在所有[field:title/]前面添加[field:city runphp='yes']@me=constant('city');[/field:city]
2)、文章URL所有[field:arcurl/]改为[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/view-[field:id/].html
例子:<h2><a href="[field:cityurl runphp='yes']@me=constant('cityurl');[/field:cityurl]/view-[field:id/].html" target="_blank">[field:city runphp='yes']@me=constant('city');[/field:city][field:title/]</a></h2>
四、其他模板修改请看第三条。
可以通过单页about文件复制修改成city.htm放在模板下,移位可以自己调整
---代码是----
{dede:php}require (DEDEROOT.'/mycity/index.php');{/dede:php}放在头部的
以下放在有需要的地方
<style>
cityan{color:#fff;padding:0 10px;}
.cityfl{width:1400px;margin:50px auto;line-height:30px;}
.cityfl dt{font-weight:bold;border-bottom:1px solid #ddd;}
.cityfl dt a{color:#f67524; font-size:14px;}
.cityfl dd{margin-bottom:20px;color:#555;}
.cityfl dd a{color:#555;font-size:14px;}
.rg .cityfz{padding: 2px 10px;background: #e77a1d;color: #fff;border-radius: 5px;}
</style>
<div class="cityfl">{dede:php}echo constant("links");{/dede:php}</div>
----------------city.htm文件代码以下----
<!doctype html>
<html>
<head>
<meta charset="utf-8">
{dede:php}require (DEDEROOT.'/mycity/index.php');{/dede:php}
<title>{dede:php}echo constant("title");{/dede:php}</title>
<meta name="keywords" content="{dede:php}echo constant("keywords");{/dede:php}">
<meta name="description" content="{dede:php}echo constant("city");{/dede:php}{dede:global.cfg_description/}">
<link href="/skin/css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
{dede:include filename="head.htm"/}
<!--此处是代码ks-->
<style>
cityan{color:#fff;padding:0 10px;}
.cityfl{width:1400px;margin:50px auto;line-height:30px;}
.cityfl dt{font-weight:bold;border-bottom:1px solid #ddd;}
.cityfl dt a{color:#f67524; font-size:14px;}
.cityfl dd{margin-bottom:20px;color:#555;}
.cityfl dd a{color:#555;font-size:14px;}
.rg .cityfz{padding: 2px 10px;background: #e77a1d;color: #fff;border-radius: 5px;}
</style>
<div class="cityfl">{dede:php}echo constant("links");{/dede:php}</div>
<!--此处是代码js-->
{dede:include filename="footer.htm"/}
</body>
</html>
发表评论 取消回复