织梦dedecms转易优cms后tag链接保持统一的方法

资源来源网络,如需授权,请更换源码,模块仅供学习,如需商用请购买正版授权,本栏目不提供技术服务,积分不够请签到!如何签到?系统升级暂停签到,恢复关注公告!
如遇下载链接蓝奏网盘打不开lanzous替换成lanzoux尝试! 广告

织梦cms转换为易优cms后tag链接发生了改变,这对seo优化有影响,如何统一tag呢?按照下面的代码重新改造一下:

<?php

require (“db.php”);

//定义url,不带后面的斜杠

$url=”http://127.0.0.1″;

//获取当前URI开始

$uri= iconv(“gb2312″,”UTF-8″,$_SERVER[‘REQUEST_URI’]);

$result = substr($uri,0,strrpos($uri,”?”));

if(!empty($result)){

$a=urldecode($result);

$b=substr($a,10);

}

else{

$res=urldecode($uri);

$b=substr($res,10);

}

 

//获取page开始

if(!isset($_GET[‘page’])or($_GET[‘page’])<=0 ){

$page=1;

}

else{

$page=$_GET[‘page’];

}

 

$min=$page*10-10;

 

 

include “head1.html”;

echo “<title>$b 标签页面</title>”;

echo “<meta name=’keywords’ content=’$b’ />”;

echo “<meta name=’description’ content=’为您提供$b 相关信息,希望对您有所帮助!’ />”;

echo “<meta http-equiv=’Cache-Control’ content=’no-transform’ />

<meta http-equiv=’Cache-Control’ content=’no-siteapp’ />

<link rel=’stylesheet’ type=’text/css’ href=’$url/template/pc/skin/css/style.css’ />

<script type=’text/javascript’ src=’$url/template/pc/skin/js/jqbs.main.js’></script>

<script type=’text/javascript’ src=’$url/template/pc/skin/js/js.js’></script>

<script type=’text/javascript’ src=’$url/public/plugins/layer-v3.1.0/layer.js’></script>

</head>”;

include “head2.html”;

 

//判断tag不为空时输出

if(!empty($b)){

 

//面包屑

echo “<div class=’g-box-1200 g-jknav’><b class=’f-jkico’></b><strong>当前位置:<a href=’$url’>网站首页</a> &gt; <a href=’$url/tag/index.html’>TAG标签</a> &gt; <a href=’$url/tag/$b-1.html’>$b</a> </strong></div>”;

//右侧标签开始

//热门标签

echo “<div class=’g-about f-fr ‘ style=’width:500px;margin-right:180px;’>

<h4 class=’u-aboutico’>TAG标签</h4>

<div class=’g-about-cont’>

<div class=’tags’>

<div class=’tags-title’>

<h2>热门标签</h2>

</div>

<ul>”;

$sql = “select tag,count from ey_tagindex order by count desc limit 40 “;

$retval = mysqli_query($conn,$sql);

$num=mysqli_num_rows($retval);

for ($i=0; $i <$num ; $i++)

{

$row=mysqli_fetch_array($retval);

$count=$row[‘count’];

$tag=$row[‘tag’];

echo “<li> <a href=’$url/tag/$tag-1.html’>$tag</a></li>”;

 

}

echo “</ul></div>”;

//随机标签

echo “<div class=’tags’>

<div class=’tags-title’>

<h2>随机标签</h2>

</div>

<ul>”;

$sql = “select tag from ey_tagindex order by rand() limit 40 “;

$retval = mysqli_query($conn,$sql);

$num=mysqli_num_rows($retval);

for ($i=0; $i <$num ; $i++)

{

$row=mysqli_fetch_array($retval);

$tag=$row[‘tag’];

echo “<li> <a href=’$url/tag/$tag-1.html’>$tag</a></li>”;

 

}

echo “</ul></div>”;

 

//周排行

echo “<div class=’tags’>

<div class=’tags-title’>

<h2>本周排行</h2>

</div>

<ul>”;

$sql = “select tag from ey_tagindex order by weekcc desc limit 40 “;

$retval = mysqli_query($conn,$sql);

$num=mysqli_num_rows($retval);

for ($i=0; $i <$num ; $i++)

{

$row=mysqli_fetch_array($retval);

$tag=$row[‘tag’];

echo “<li> <a href=’$url/tag/$tag-1.html’>$tag</a></li>”;

 

}

echo “</ul></div>”;

 

//月排行

echo “<div class=’tags’>

<div class=’tags-title’>

<h2>本月排行</h2>

</div>

<ul>”;

$sql = “select tag from ey_tagindex order by monthcc desc limit 40 “;

$retval = mysqli_query($conn,$sql);

$num=mysqli_num_rows($retval);

for ($i=0; $i <$num ; $i++)

{

$row=mysqli_fetch_array($retval);

$tag=$row[‘tag’];

echo “<li> <a href=’$url/tag/$tag-1.html’>$tag</a></li>”;

 

}

echo “</ul></div></div></div>”;

//右侧标签结束

echo”<div class=’g-box-1200 clearfix g-box-bgico’>

<div class=’w845 f-fl clearfix’>

<ul class=’g-newslist clearfix’>”;

//利用关键字查询tag,获取包含tag的文档aid

$sql = “select aid from ey_taglist where tag=’$b'”;

$retval = mysqli_query($conn,$sql);

$num1=mysqli_num_rows($retval);

if ($num1>10){

$sql = “select aid from ey_taglist where tag=’$b’ order by aid desc limit $min,10 “;}

else{

$sql = “select aid from ey_taglist where tag=’$b’ order by aid desc limit 10 “;

}

$retval = mysqli_query($conn,$sql);

$num=mysqli_num_rows($retval);

for ($i=0; $i <$num1 ; $i++)

{

$row=mysqli_fetch_array($retval);

$aid=$row[‘aid’];

//利用aid查询typeid title seo_description

$sql1 = “select * from ey_archives where aid=’$aid'”;

$retval1 = mysqli_query($conn,$sql1);

$row1=mysqli_fetch_array($retval1);

$title=$row1[‘title’];

$typeid=$row1[‘typeid’];

$add_time=date(‘Y-m-d’,$row1[‘add_time’]);

$seo_description=$row1[‘seo_description’];

 

//利用typeid查询文档所在目录,拼接文档URL

$click=rand(111,999);//随机阅读变量

if (!empty($typeid)){

$sql2 = “select dirpath from ey_arctype where id=’$typeid'”;

$retval2 = mysqli_query($conn,$sql2);

$num=mysqli_num_rows($retval);

$row2=mysqli_fetch_assoc($retval2);

$dirpath=$row2[‘dirpath’];

echo “<li><a href=’$url$dirpath/$aid.html’><i><img src=’$url/img/$aid.png’ alt=’$title’></i>

<p>$title</p>

<em>$seo_description…</em><span><strong class=’u-yuedu’>$click 人阅读</strong><strong class=’u-time’>发布时间:$add_time</strong></span></a></li>”;

 

}

 

}

echo “</ul>”;

 

 

//翻页变量定义

$pre=$page-1;

if ($pre<=0){

$pre=1;

}

$next=$page+1;

$end=ceil($num1/10);

if($end==0){

echo “<script>layer.alert(‘未找到相关内容’,{icon: 5},function(){window.location.href=’$url/tag’});</script>”;

}

if ($end==1){

$page==$end;

}

 

//定义每页页码数

$pagesize=5;

 

if ($page+$pagesize<$end){

$pageno=$page+$pagesize;

}

else{

$pageno=$end+1;

}

 

if ($page==1 or empty($page))

{

echo “</ul><div class=’m-page’><ul>”;

echo “<a onclick=’pre()’ ><li>首页</li></a> <a onclick=’pre()’><li>上一页</li></a>”;

echo “<script>function pre(){layer.alert(‘已经是领先页了!’,{icon: 7})};</script>”;

}

else{

echo “</ul><div class=’m-page’><ul>”;

echo “<a href=’$url/tag/$b-1.html’ ><li>首页</li></a> <a href=’$url/tag/$b-$pre.html’><li>上一页</li></a>”;

}

 

//输出页码

if ($end>1 && $page<$end){

for ($i=$page;$i<$pageno;$i++){

echo “<a href=’$url/tag/$b-$i.html’><li id=’$i’>$i</li></a> “;

}

echo “<a href=’$url/tag/$b-$next.html’><li>下一页</li></a> <a href=’$url/tag/$b-$end.html’><li>末页</li></a><li>共 $end 页</li>”;

echo “</ul></div></div></div>”;

}

else{

 

//首页末页判断提示

if ($page>=$end){

echo “<a onclick=’next()’><li>下一页</li></a> <a onclick=’next()’><li>末页</li></a><li>共 $end 页</li></ul></div></div>”;

echo “<script>function next(){layer.alert(‘已经是最后一页了!’,{icon: 7})};</script>”;

echo “</ul></div></div></div>”;

}

}

if($end>=1){

echo “<script>document.getElementById(‘$page’).classList.add(‘active’);</script>”;

}

 

 

}

//无tag时输出tag汇总页

else{

echo “<div class=’g-box-1200 g-jknav’><b class=’f-jkico’></b><strong>当前位置:<a href=’$url/’>网站首页</a> &gt; <a href=’$url/tag/index.html’>TAG标签</a></strong></div>”;

echo “<div class=’g-about f-fr ‘ style=’width:1200px;margin-right:18%;margin-top:30px;’>

<h4 class=’u-aboutico’>TAG标签汇总</h4>

<div class=’g-about-cont’>

<div class=’tags’>

<ul>”;

$sql = “select tag,count from ey_tagindex order by count desc”;

$retval = mysqli_query($conn,$sql);

$num=mysqli_num_rows($retval);

for ($i=0; $i <$num ; $i++)

{

$row=mysqli_fetch_array($retval);

$count=$row[‘count’];

$tag=$row[‘tag’];

echo “<li> <a href=’$url/tag/$tag-1.html’>$tag</a></li>”;

 

}

echo “</ul></div></div></div>”;

}

include “foot.html”;

?>

db.php写入自己的数据库链接信息。

 

©下载资源版权归作者所有;本站所有资源均来源于网络,仅供学习使用,请支持正版!
风格酷模板网 » 织梦dedecms转易优cms后tag链接保持统一的方法
NOTICE:【咨询风格酷】客服QQ:1131734965
NOTICE:【咨询风格酷】客服微信:wwwxmamnet
NOTICE:【风格酷模板网②群】QQ群:288678775
☉免责声明:本站所有模板均来自用户分享和网络收集,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服,我们核实后会立即删除。
☉如果源码网盘地址失效!或有其他问题,请点我报错,谢谢合作!
☉人民币与积分汇率为1比10,即1元=10积分.有任何疑问请联系客服
☉如有其他问题,请加网站客服QQ(1131734965)进行交流。
☉本站提供的源码、模板、软件工具等其他资源,都不包含技术服务,请大家谅解!
☉源码、模板等资源会随着技术、环境的升级而存在部分问题,还请慎重选择。

发表评论

风格酷模板网www.xmam.net分享优质网站模板

立即查看 了解详情