cms里文章页自定义文件名去掉html方法

、cms里文章页自定义文件名去掉html方法,文章命名规则即便去掉html,在自定义文件名里生成的时候调取本页面链接依然会带html,用已下代码替换掉.html

bash 复制代码
<link rel="canonical" href="{dede:global.cfg_basehost/}{dede:field name='arcurl' function='str_replace(".html", "", @me)'/}">

.找到上一篇下一篇,在include文件夹下的arc.archives.class.php

bash 复制代码
$preRow['namerule'],$preRow['typedir'],$preRow['money'],$preRow['filename'],$preRow['moresite'],$preRow['siteurl'],$preRow['sitepath']);

修改成

bash 复制代码
$preRow['namerule'],$preRow['typedir'],$preRow['money'],$preRow['filename'],$preRow['moresite'],$preRow['siteurl'],$preRow['sitepath']);
				// 修改:移除 .html 扩展名
				$mlink = str_replace('.html', '', $mlink);
bash 复制代码
$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],$nextRow['filename'],$nextRow['moresite'],$nextRow['siteurl'],$nextRow['sitepath']);

修改成

bash 复制代码
$nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],$nextRow['filename'],$nextRow['moresite'],$nextRow['siteurl'],$nextRow['sitepath']);
					// 修改:移除 .html 扩展名
					$mlink = str_replace('.html', '', $mlink);

、找到include文件夹下的arc.listview.class.php,修改list列表页生成的自定义名字去掉html。

找到

bash 复制代码
                    $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
                    $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);
                    $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],
                    $row['ispart'],$row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']);

修改成

bash 复制代码
                    $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
                    $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);
                    $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],
                    $row['ispart'],$row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']);
					
					 // 去掉 .html 后缀
            $row['arcurl'] = str_replace('.html', '', $row['arcurl']);
            $row['filename'] = str_replace('.html', '', $row['filename']);
            $row['typeurl'] = GetTypeUrl($row['typeid'], MfTypedir($row['typedir']), $row['isdefault'], $row['defaultname'],
            $row['ispart'], $row['namerule2'], $row['moresite'], $row['siteurl'], $row['sitepath']);

、修改tag静态生成,文章链接自定义的不带html

找到

bash 复制代码
$row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
					$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);

注释掉原代码,修改成

bash 复制代码
/* $row['filename'] = $row['arcurl'] = etFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'],
$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']);*/
					// 修改后的代码:去掉 .html 后缀
$row['filename'] = $row['arcurl'] = str_replace('.html', '', GetFileUrl($row['id'], $row['typeid'], $row['senddate'], $row['title'], $row['ismake'], $row['arcrank'], $row['namerule'], $row['typedir'], $row['money'], $row['filename'], $row['moresite'], $row['siteurl'], $row['sitepath']));
					//结束
相关推荐
电商API大数据接口开发Cris几秒前
API 接口接入与开发演示:教你搭建淘宝商品实时数据监控
前端·数据挖掘·api
用户1409508112801 分钟前
原型链、闭包、事件循环等概念,通过手写代码题验证理解深度
前端·javascript
汪子熙2 分钟前
错误消息 Could not find Nx modules in this workspace 的解决办法
前端·javascript
skeletron201117 分钟前
🚀AI评测这么玩(2)——使用开源评测引擎eval-engine实现问答相似度评估
前端·后端
前端开发爱好者17 分钟前
Vite 7.1.1 疑似遭受大规模 "攻击"!
前端·vue.js·vite
小徐_233319 分钟前
uni-app 还在手写请求?alova 帮你全搞定!
前端·uni-app·axios
七十二時_阿川31 分钟前
React 浏览器重新绘制之前副作用之useLayoutEffect
前端·程序员
Apifox32 分钟前
API 文档中有多种参数结构怎么办?Apifox 里用 oneOf/anyOf/allOf 这样写
前端·后端·测试
IT小番茄37 分钟前
若依框架导出 Excel 签名实现方案
前端·后端
枫叶是圆的40 分钟前
纯CSS+JS制作抽奖大转盘
前端·javascript·css·html·css3