织梦dedecms转易优cms后tag链接保持统一的方法
织梦cms转换为易优cms后tag链接发生了改变,这对seo优化有影响,如何统一tag呢?按照下面的代码重新改造一下:
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 “
echo “”;
echo “”;
echo “
”;
include “head2.html”;
//判断tag不为空时输出
if(!empty($b)){
//面包屑
echo “
”;//右侧标签开始
//热门标签
echo “
TAG标签
//随机标签
echo “
”;//周排行
echo “
”;//月排行
echo “
//右侧标签结束
echo”
- ”;
-
$title
$seo_description…$click 人阅读发布时间:$add_time
”;
//利用关键字查询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 “
}
}
echo “
//翻页变量定义
$pre=$page-1;
if ($pre<=0){
$pre=1;
}
$next=$page+1;
$end=ceil($num1/10);
if($end==0){
echo “”;
}
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 “
}
else{
//首页末页判断提示
if ($page>=$end){