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

dedecms的栏目内容制作、调取、单页企业简介的方法

dedecms如何让一个栏目来充当内容页呢?比如我们经常要做的企业简介和联系我们,那么我们想实现的是点开栏目就是内容,并不是列表,那么这样做,新建一个栏目,比如是企业简介,那么建的时候是这样的!

1、新建栏目,在常规属性里把栏目属性选择成频道封面,如图:
dedecmss1

2、在点击高级选项,这里需要自己建立一个模版,其实很简单,就把你的内容模版(article_article.htm)拿出来复制一份,找到里面的 {dede:field.body/}这句换成 {dede:field.content/}这个,然后把文件随意换个名字,我这里换成了singlepage.htm,然后放到模版文件夹里,然后在下面的封面模版选择你刚才做的singlepage.htm模版!

dedecmss2

3、然后选择栏目内容,写你要写的东西!这就搞定了,确定-刷新栏目页!

dedexmss3

下面介绍下如何在首页调取这些企业简介的文字…

比如我们经常把把企业简介在首页展示一半..那么就涉及到调取的问题,怎么调取呢?用下面的代码,看你调取需求选择(复制代码的时候注意符号的大小写):
1、直接调取所有内容

{dede:sql sql=”Select content from 你的表名前缀_arctype where id=栏目ID”}[field:content /]{/dede:sql}

2、比如有时候需要过滤掉HTML标签

{dede:sql sql=”Select content from 你的表名前缀_arctype where id=栏目ID”}[field:content function=’html2text(@me)’/]{/dede:sql}

3、有时候还需要做字数限制

{dede:sql sql=”Select content from 你的表名前缀_arctype where id=栏目ID”}[field:content function=’html2text(cn_substr(@me,400))’/]{/dede:sql}

 

经过实践测试,以上的SQL语句都必须用双引号!单引号无效!

除了这些其实dedecms里很多调用都有差不多,如果有条件限制的话就像上面在字段名后加 funtion函数,就是下面代码,可以调用一切表的东西!

{dede:sql sql=”select 字段 From 表名称 where 条件语句”}
[field:字段名/]
{/dede:sql}


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

分享该文章到:

3 条评论

  1. heyuan说道:

    路过来学习一下,欢迎有时间回访



回复 heyuan 取消回复

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

分类

最新评论

  • 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