当前位置:网站首页>织梦通过数据库查询调用当前文章的留言
织梦通过数据库查询调用当前文章的留言
2022-08-01 20:46:00 【网站建设影子】
通过数据库查询法进行代码如下
{dede:sql sql="SELECT a.username,a.msg FROM dede_feedback a where ischeck=1 and aid=~id~ ORDER BY id Desc LIMIT 0 , 3"} <li>[field:username function="(@me=='guest'? '游客' : @me)"/]:[field:msg/]</li>
{/dede:sql}
代码说明
查询评织梦论表(dede_feedback)中的username和msg字段,查询条件为文章ID是当前文章的ID( aid=~id~ ),评论内容已经审核过(ischeck=1),并且排序为倒序排列就是最先评论的第一个显示(ORDER BY id Desc)只查询前3条评论内容(LIMIT 0 , 3)。
当然如果想调用头像,就是调用织梦feedback表中的face字段里的头像可以在上面查询数据库中加入一段a.face调用<img src=”[field:face/]”>;完整代码如下:
{dede:sql sql="SELECT a.username,a.msg,a.face FROM dede_feedback a where ischeck=1 and aid=~id~ ORDER BY id Desc LIMIT 0 , 3"} <li>[field:username function="(@me=='guest'? '游客' : @me)"/]:[field:msg/]</li>
{/dede:sql}
边栏推荐
- LTE time domain and frequency domain resources
- [Energy Conservation Institute] Ankerui Food and Beverage Fume Monitoring Cloud Platform Helps Fight Air Pollution
- SIPp installation and use
- 人工智能可信安全与评测
- Imitation cattle forum project
- 通配符 SSL/TLS 证书
- Go 语言中常见的坑
- Hangao data import
- Different operating with different locks, rounding
- [Multi-task optimization] DWA, DTP, Gradnorm (CVPR 2019, ECCV 2018, ICML 2018)
猜你喜欢
Remove 360's detection and modification of the default browser
宝塔搭建PESCMS-Ticket开源客服工单系统源码实测
【torch】张量乘法:matmul,einsum
数据库内核面试中我不会的问题(1)
外骨骼机器人(七):标准步态数据库
Digital twin Beijing the imperial palace, yuan universe is the process of tourism
Acrel-5010重点用能单位能耗在线监测系统在湖南三立集团的应用
MySQL Syntax Basics
Which websites are commonly used for patent searches?
仿牛客论坛项目
随机推荐
通俗解释:什么是临床预测模型
Zheng Xiangling, Chairman of Tide Pharmaceuticals, won the "2022 Outstanding Influential Entrepreneur Award" Tide Pharmaceuticals won the "Corporate Social Responsibility Model Award"
98. Embedded controller EC actual combat EC development board development completed
Pytorch框架学习记录12——完整的模型训练套路
Excel advanced drawing techniques, 100 (22) - how to respectively the irregular data
MongoDB快速上手
Pytorch框架学校记录11——搭建小实战完整细节
】 【 nn. The Parameter () to generate and why do you want to initialize
tiup mirror init
Godaddy域名解析速度慢问题以及如何使用DNSPod解析解决
iptables的使用简单测试
Fork/Join线程池
外骨骼机器人(七):标准步态数据库
Digital twin Beijing the imperial palace, yuan universe is the process of tourism
【Kaggle】Classify Leaves
瀚高数据导入
【Untitled】
Pytorch框架学习记录10——线性层
[Energy Conservation Institute] Application of Intelligent Control Device in High Voltage Switchgear
[Multi-task optimization] DWA, DTP, Gradnorm (CVPR 2019, ECCV 2018, ICML 2018)