关注互联网、关注WEB前端设计、关注技术、关注程序、关注生活
上一篇:dedeCMS模板安装教程 下一篇:dede5.3去掉软件缩略图及换成广告的方法

SQL自由调用标记整理 For DedeV53

一、推荐企业的调用:


{dede:sql sql="SELECT m.mid,m.mtype,m.userid,m.matt,c.mid,c.company
FROM dede_member m
left join dede_member_company c on m.mid = c.mid
WHERE m.mtype ='企业'
ORDER BY m.jointime DESC
LIMIT 0 , 27 "}
<li><a href='[field:global name='cfg_cmspath'/]/member/?[field:userid/]/' target="_blank"><font color="#000066"><font color='#000066'>[field:company/]</font></font></a> </li>
{/dede:sql}

简要说明:本SQL语句是用到了 left join 匹配查询,这里同时查询了dede_member 和 dede_member_company 两个数据表,满足的条件严格来说,这里是两个—— ①:会员类型(mtype)必须为企业, ②: 会员的ID必须一样 ;

二、调用Discuz论坛附件带图片的贴子


{dede:sql sql="SELECT cdb_p_w_uploads.aid,cdb_p_w_uploads.p_w_upload,cdb_threads.tid,cdb_threads.fid,cdb_threads.subject FROM cdb_p_w_uploads LEFT JOIN cdb_threads ON cdb_threads.tid= cdb_p_w_uploads.tid WHERE cdb_p_w_uploads.readperm = 0 AND displayorder >= 0 AND filetype= p_w_picpath/pjpeg GROUP BY tid LIMIT 0,2"}
<li><A href="/bbs/viewthread.php?tid=[field:tid /]"><IMG src="/bbs/p_w_uploads/[field:p_w_upload/]"></A></li>
<li><A href="/bbs/viewthread.php?tid=[field:tid /]">[field:subject function="cn_substr('@me',30)" /]</A></li>
{/dede:sql}

三、调用UCHOME最新日志


{dede:sql sql="Select subject,viewnum,blogid,uid From uchome_blog order by blogid desc limit 0,8"}
<li><A href="uchome访问地址/space.php?uid=[field:uid/]&do=blog&id=[field:blogid/]">[field:subject function="cn_substr('@me',24)" /]</A></li>
{/dede:sql}

四、调用会员积分排行


{dede:sql sql="Select id,userid,uname,scores From dede_member order by scores desc limit 0,10"}
<dd><span class="name"><a href='[field:global name='cfg_cmspath'/]/member/?[field:userid/]/'>[field:uname/]</a>
</span><span class="jifen">积分[field:scores/]</span></dd>
{/dede:sql}

五、调用企业会员的最新产品(包含产品图片)

{dede:sql sql="SELECT a.id,a.litpic,a.title FROM dede_addonproduct p left join dede_archives a on a.id = p.aid order by a.id desc LIMIT 0 , 4"}
<li><div><a href="/plus/view.php?aid=[field:aid/]" title="[field:title/]"><img src="[field:litpic/]" alt="[field:title/]"/></a></div><a href="/plus/view.php?aid=[field:aid/]" title="[field:title/]">[field:title/]</a></li>
{/dede:sql}

六、调用最新加入企业及企业的所属行业


{dede:sql sql="SELECT m.mid,m.mtype,m.userid,m.matt,c.mid,c.company,c.comface,d.ename,d.evalue,d.egroup FROM dede_sys_enum as d ,dede_member as m left join dede_member_company c on m.mid = c.mid where m.mtype ='企业' and m.matt = 1 and c.vocation=d.evalue and d.egroup='vocation' LIMIT 0 , 10"}
企业名称:[field:company/] 企业行业为[field:ename/]
{/dede:sql}

七、调用推荐企业(带头像)

{dede:sql sql="SELECT m.ID,m.type,m.userid,m.matt,m.spacep_w_picpath,c.id,c.comname
FROM dede_member m left join dede_member_cominfo c on m.ID = c.id
where m.type = 1 and m.matt = 1
LIMIT 0 , 10"}
头像:<img src="[field:spacep_w_picpath runphp='yes']
if(!@me)@me = '/uploadfile/200904/19/63000414.gif';
[/field:spacep_w_picpath]" />
用户名:<a href='[field:global name='cfg_cmspath'/]/member/?[field:userid/]/'>[field:comname/]</a>
{/dede:sql}

八、调用UCenter Home会员(带头像)

{dede:sql sql="SELECT * FROM `uchome_space` WHERE `avatar` =1 LIMIT 0 , 10"}
<a href="你安装UCenter Home的地址/space.php?uid=[field:uid/]">
<img src='你安装UCenter的地址/avatar.php?uid=[field:uid/]&size=[field:small/]' border='0' width='99' height='88' >
<br />
[field:username/]</a>
{/dede:sql}



 


欢迎关注,TC文章有的来源于网络,如果侵犯了您的权益,我们将在第一时间处理。

本文地址:http://20tc.com/int/dedecms/2049.html

订阅博客

  • 订阅我的博客:订阅我的博客
  • 关注新浪微博:关注新浪微博
  • 关注腾讯微博:关注腾讯微博

热点标签

Google 广告

本站采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载本站内容必须也遵循"署名-非商业用途-保持一致"的创作共用协议.
This site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.