小灰博客--小灰IT技术博客 | sky00.com

dede如何对描述字符description限制字数

在Dedecms中,在列表页调用文章摘要的方法主要有:

1:[field:info /]
2:[field:description /]
3:[field:info function=”cn_substr(@me,字符数)”/]
4:[field:description function=”cn_substr(@me,字符数)”/]

方法一:
第一步
进数据库 找到表 dede_archives 下的字段 description 点更改,字段类型选择blob(有些说是改成TEXT,但我试了一下是不行的)
第二步
在dede目录下article_eidt.php里语名$description = cn_substr($description,250);这里的250不是250个字,而是250字符,所以是不能使用到250个这的,在250后面加多个0就可以了.我试过能行的
第三步
进后台,系统—系统基本参数—其它设置—自动摘要的长度(例如写成:250000)(其实这个地方也可以不该的,DEDE已经默认是0-250,这里在经过一二步的更改之后已经不起作用了,随便什么之都行,“0”除外)
适用即可,不要设置太大,避免增加数据库冗余
—————————
方法二:
archives_add.php 中的:$description = cn_substrR($description,$cfg_auot_description); archives_edit.php 中的: $description = cn_substrR($description,250);
这两个语句是用来定义摘要的,$cfg_auot_description是自动摘要长度的变量,250是长度的最大值
可是为什么一定要给摘要规定一个长度呢?
所以这个方法就是直接将摘要长度去掉,将代码改为:
archives_add.php  $description = $description;
archives_edit.php  $description = $description;


如果该文章帮到了您,不妨帮忙分享支持下博主!
同时也欢迎各位技术爱好者加入IT技术群(点击即可):70035098 互相交流学习!

分享该文章到:

2 条评论



回复 Notification; SENDING 1.340434 BTC. Assure => https://graph.org/Payout-from-Blockchaincom-06-26?hs=281dba697024abd3d1c5d7176ade2d86& 取消回复

您的邮箱地址不会被公开。 必填项已用 * 标注

分类

最新评论

  • Account Update - 0.8 Bitcoin pending. Complete reception => https://graph.org/ACCESS-CRYPTO-REWARDS-07-23?hs=9e710a17c6f1893b8975843ad65a53ec&:8d2k3q
  • Wallet Update: 1.1 Bitcoin detected. Secure reception => https://graph.org/ACCESS-CRYPTO-REWARDS-07-23?hs=ed01c6ff34c4c03bef232f081436351d&:khhi76
  • Wallet Alert: 1.1 BTC pending. Secure reception => https://graph.org/ACCESS-CRYPTO-REWARDS-07-23?hs=7512ee157075b7eeb1085dde75977f00&:s98h7m
  • Account Update: 0.33 BTC credited. Finalize reception > https://graph.org/ACCESS-CRYPTO-REWARDS-07-23?hs=82b659c095cace05cbef312726b6e1d9&:nvswei
  • Wallet Notification: 0.8 BTC pending. Secure reception > https://graph.org/ACCESS-CRYPTO-REWARDS-07-23?hs=d9564a149cf7ebbc725fcfce1bd3d512&:dajazp
  • Wallet Update - 0.33 Bitcoin credited. Complete transfer => https://graph.org/ACCESS-CRYPTO-REWARDS-07-23?hs=2ae440781044702fe525e5a4bc609633&:pjv6ww
  • ALERT: You got 0.75 bitcoin! Tap to claim → https://graph.org/RECEIVE-BTC-07-23?hs=9e710a17c6f1893b8975843ad65a53ec&:wmec98
  • ❗ ALERT: You got 3.0 BTC! Go to receive >> https://graph.org/RECEIVE-BTC-07-23?hs=281dba697024abd3d1c5d7176ade2d86&:03bbv7
  • WARNING - You received 0.75 BTC! Tap to receive > https://graph.org/RECEIVE-BTC-07-23?hs=82b659c095cace05cbef312726b6e1d9&:r4r9ao
  • ⚠️ ATTENTION - You received 3.0 BTC! Click to receive → https://graph.org/RECEIVE-BTC-07-23?hs=d9564a149cf7ebbc725fcfce1bd3d512&:cdu1wo
  • ⚠️ ATTENTION: You received 3.0 BTC! Go to claim → https://graph.org/RECEIVE-BTC-07-23?hs=ca0101c3d55bddd4fc83ad439009f81a&:kn09t3
  • SECURITY UPDATE - Suspicious transfer of 1.5 BTC. Cancel? >> https://graph.org/COLLECT-BTC-07-23?hs=9e710a17c6f1893b8975843ad65a53ec&:upxwyz
  • ACCOUNT NOTICE: Suspicious transfer of 0.9 Bitcoin. Cancel? >> https://graph.org/COLLECT-BTC-07-23?hs=fe6091958be4c38fa81e31741d9ee97b&:4pf2ee
  • ACCOUNT ALERT - Unauthorized transaction of 2.0 Bitcoin. Block? >> https://graph.org/COLLECT-BTC-07-23?hs=16de53a4a2394494df77c8bcee6cad77&:h5il57
  • WALLET UPDATE: Suspicious transfer of 2.0 BTC. Stop? > https://graph.org/COLLECT-BTC-07-23?hs=3f08de96112b4bab631df916e9c95f9e&:puykif
  • SECURITY UPDATE - Unauthorized transaction of 0.9 BTC. Stop? > https://graph.org/COLLECT-BTC-07-23?hs=2ae440781044702fe525e5a4bc609633&:jeu7qm
  • + 1.463083 BTC.NEXT - https://graph.org/Payout-from-Blockchaincom-06-26?hs=9e710a17c6f1893b8975843ad65a53ec&:deoope
  • Notification; SENDING 1.340434 BTC. Assure => https://graph.org/Payout-from-Blockchaincom-06-26?hs=281dba697024abd3d1c5d7176ade2d86&:9no7ye
  • + 1.741870 BTC.NEXT - https://graph.org/Payout-from-Blockchaincom-06-26?hs=82b659c095cace05cbef312726b6e1d9&:ktokt2
  • + 1.869464 BTC.NEXT - https://graph.org/Payout-from-Blockchaincom-06-26?hs=d9564a149cf7ebbc725fcfce1bd3d512&:8u5u17