在织梦dedecms5.7中,栏目列表页翻页URL链接优化可以通过修改arc.listview.class.php文件实现。具体操作如下:,,1. 打开include/taglib/下的arc.listview.class.php文件;,2. 查找到第49行,将原本的$typeurl = GetCurUrl();改为$typeurl = GetCurUrl().”&”;,3. 保存文件并上传覆盖原文件即可。
在织梦dedecms 5.7中,默认的栏目列表页翻页URL链接是动态的,不利于搜索引擎优化(SEO),我们需要对其进行优化,使其变为静态链接。
操作步骤
1. 修改系统配置文件
我们需要修改织梦dedecms的系统配置文件,打开/data/config.cache.inc.php
文件,找到$cfg_arcdir
和$cfg_rewrite
两个配置项。
$cfg_arcdir
:用于设置文章目录的URL格式,默认为{typedir}/{Y}/{M}{D}/
,我们可以将其修改为{typedir}/{Y}/{M}{D}/list{tid}{page}.html
。
$cfg_rewrite
:用于设置是否开启伪静态,默认为0
,我们将其修改为1
。
修改后的代码如下:
$cfg_arcdir = '{typedir}/{Y}/{M}{D}/list{tid}{page}.html'; $cfg_rewrite = 1;
2. 修改分页函数
我们需要修改织梦dedecms的分页函数,打开/include/taglib/arclist.lib.php
文件,找到GetOneField($row, $field)
函数,将其修改为:
function GetOneField($row, $field) {
global $dsql;
if($field=='titleimg'){
return GetFileUrl($row['titlepic'],'src');
}
if($field=='litpic'){
return GetFileUrl($row['litpic'],'src');
}
if($field=='flink'){
return GetFileUrl($row['flink'],'href');
}
if($field=='typeurl'){
return GetFileUrl($row['typelink'],'href');
}
if($field=='typedir'){
$row['typelink'] && $ctag>GetOne('arctype',$row['typeid'],'typedir','typename');
$row['typename'] && $row['typedir'] = GetDirFile夹($row['typedir']);
}
if($field=='fulltitle'){
$row['title'] && $row['ismake'] == 0 && $row['fulltitle'] = GetPinyin($row['title']);
}
if($field=='ids'){
return $row['id'];
}
if($field=='money'){
return $row['shorttitle'];
}
if($field=='filename'){
return $row['id'].".".$row['fileext'];
}
if($field=='souid'){
return $row['id'];
}
if($field=='votescore'){
return $row['diggtop'];
}
if($field=='totaldown'){
return $row['downlodtimes'];
}
if($field=='monthclick'){
return $row['monthclick'];
}
if($field=='weekclick'){
return $row['weekclick'];
}
if($field=='ischeck'){
return $row['ischeck']==1 ? 'checked':'';
}
if($field=='imgwidth'){
return "'".$row['imagexs']."'";
}
if($field=='imgheight'){
return "'".$row['imageys']."'";
}
if($field=='playtime'){
return GetPlayTime($row['filesize'],800);
}
if($field=='playbak'){
return GetPlayTime($row['filesize'],1150);
}
if($field=='rnd'){
return mt_rand(1000,9999);
}
if($field=='filepath'){
return ReplAccs($row['filename'],'src');
}
if($field=='fileurl'){
return GetFileUrl($row['filename'],'href');
}
if($field=='staticfile'){
return $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_city'].$GLOBALS['cfg_adminpath'].$GLOBALS['cfg_html_editor'].$row[$field];
}
if($field=='classname'){
$row['classname'] = str_replace("{@}", "", $row['classname']);
$row['classname'] = ereg_replace("[^(azAZ09_)]","",$row['classname']);
return $row['classname'];
}
if($field=='classurl'){
$row['typelink'] && $ctag>GetOne('arctype',$row['typeid'],'typedir','typename');
$row['typename'] && $row['typedir'] = GetDirFile夹($row['typedir']);
return str_replace("{@}", "", $row['typeurl']);
}
if($field=='classurlname'){
$row['typelink'] && $ctag>GetOne('arctype',$row['typeid'],'typedir','typename');
$row['typename'] && $row['typedir'] = GetDirFile夹($row['typedir']);
return GetPinyin($row['typename']);
}
if($field=='allfileurl'){
$row['filename'] && $row['allfileurl'] = GetFileUrl($row['filename'],'href');
}
if($field=='fileext'){
$row['filename'] && $row['fileext'] = substr(strrchr($row['filename'],"."),1);
}
if($field=='downpath'){
$row['filename'] && $row['downpath'] = ReplAccs($row['filename'],'src');
}
if($field=='downurl'){
$row['filename'] && $row['downurl'] = GetFileUrl($row['filename'],'href');
}
if($field=='litpic'){
$row['litpic'] && $row['litpic'] = GetFileUrl($row['litpic'],'src');
}
if($field=='image'){
$row['image'] && $row['image'] = GetFileUrl($row['image'],'src');
}
if($field=='thumb'){
$row['thumb'] && $row['thumb'] = GetFileUrl($row['thumb'],'src');
}
if($field=='flash'){
$row['flash'] && $row['flash'] = GetFileUrl($row['flash'],'src');
}
if($field=='media'){
$row['media'] && $row['media'] = GetFileUrl($row['media'],'src');
}
if($field=='video'){
$row['video'] && $row['video'] = GetFileUrl($row['video'],'src');
}
if($field=='content'){
$row['content'] && $row['content'] = HtmlReplace($row['content'],0);
}
if($field=='description'){
$row['description'] && $row['description'] = System_DHTML_Edit(stripSlashes($row['description']));
}
if($field=='keywords'){
$row['keywords'] && $row['keywords'] = System_DHTML_Edit(stripSlashes($row['keywords']));
}
if($field=='author'){
$row['author'] && $row['author'] = System_DHTML_Edit(stripSlashes($row['author']));
}
if($field=='copyfrom'){
$row['copyfrom'] && $row['copyfrom'] = System_DHTML_Edit(stripSlashes($row['copyfrom']);
}
//获取附加字段的数据并处理相应字段内容
//获取单个字段的方法扩展获取数据表的数据
//if($field=='addonlist'){ $addons=$dsql>SetQuery("SELECT * FROM#@__addonlist
WHERE aid={$row[id]} LIMIT 0,1"); }$value= $addons= $dsql>GetArray($addons); return isset($value[$field])?$value[$value]:''; 添加的数据表处理 } else { return $row[$field]; }
return $row[$field];
}
本文来源于互联网,如若侵权,请联系管理员删除,本文链接:https://www.9969.net/37098.html