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']));
					//结束
相关推荐
慧一居士18 小时前
vue.config.js 文件功能介绍,使用说明,对应完整示例演示
前端·vue.js
颜酱18 小时前
用导游的例子来理解 Visitor 模式,实现AST 转换
前端·javascript·算法
蒙特卡洛的随机游走19 小时前
Spark的宽依赖与窄依赖
大数据·前端·spark
共享家952719 小时前
QT-常用控件(多元素控件)
开发语言·前端·qt
葱头的故事19 小时前
将传给后端的数据转换为以formData的类型传递
开发语言·前端·javascript
_233319 小时前
vue3二次封装element-plus表格,slot透传,动态slot。
前端·vue.js
jump68019 小时前
js中数组详解
前端·面试
崽崽长肉肉19 小时前
iOS 基于Vision.framework从图片中提取文字
前端
温宇飞19 小时前
Web Abort API - AbortSignal 与 AbortController
前端
Tomoon19 小时前
前端开发者的全栈逆袭
前端