朝霞的颜色多的不能再多了。有橘黄色桃红色朱红色葡萄紫,还有淡红色等等。我觉得大自然有一个五颜六色的彩笔盒,把天空当画板,给天空上色。
百度知道里看到有人提问,帮写了一个。
模板里调用SQL:
|
1
2
3
4
5
6
|
{dede:sqlsql="selecta.id,a.title,a.writer,a.pubdate,a.typeid,b.aid,b.sexfromdede_archivesaLEFTJOINdede_addonarticlebonb.aid=a.idwherea.typeid='7'anda.writer=~writer~andb.sex='男'orderbya.pubdatedescLIMIT0,5"}<li>文章ID:[field:id/]</li><li>标题:<arel="nofollow noopener noreferrer" href="[field:idfunction='GetOneDocUrl(@me)'/]">[field:title/]</a></li><li>作者:[field:writer/]</li><li>性别:[field:sex/]</li>{/dede:sql} |
a.typeid=7 调用ID为7的栏目 如果不需要指定栏目ID 那么你可以把 a.typeid='7' and 删掉
a.writer=~writer~ 调用当前文章的作者,调用指定的作者,可以这样写a.writer='admin' 这样就是指定调用admin这个作者的文档
b.sex=男 设置性别,也就是自定义字段。如果你的自定义字段不是sex 那么你只要把sql里的b.sex 改成你的字段,例如 name 改成b.name
LIMIT 0,5 设置要调用的条数,我这里写的是5条,自行修改.
指定调用2个栏目的话 可以把where a.typeid='7' 修改为 where a.typeid='7' and a.typeid='8'
这样就指定调用栏目ID 为 7和8的栏目
GetOneDocUrl 函数 放到incluce/extend.func.php 文件中,这个函数是用来调用文档的静态URL的。
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
functionGetOneDocUrl($aid){global$dsql;include_once(DEDEINC."/channelunit.func.php");$aid=trim(ereg_replace('[^0-9]','',$aid));$chRow=$dsql->GetOne("Selectarc.*,ch.maintable,ch.addtable,ch.issystemFrom`dede_arctiny`arcleftjoin`dede_channeltype`chonch.id=arc.channelwherearc.id='$aid'");if(!is_array($chRow)){return$reArr;}else{if(empty($chRow['maintable']))$chRow['maintable']='dede_archives';}if($chRow['issystem']!=-1){$nquery="Selectarc.*,tp.typedir,tp.topid,tp.namerule,tp.moresite,tp.siteurl,tp.sitepathFrom`{$chRow['maintable']}`arcleftjoin`dede_arctype`tpontp.id=arc.typeidwherearc.id='$aid'";}else{$nquery="Selectarc.*,1asismake,0asmoney,''asfilename,tp.typedir,tp.topid,tp.namerule,tp.moresite,tp.siteurl,tp.sitepathFrom`{$chRow['addtable']}`arcleftjoin`dede_arctype`tpontp.id=arc.typeidwherearc.aid='$aid'";}$arcRow=$dsql->GetOne($nquery);$Url=GetFileUrl($aid,$arcRow['typeid'],$arcRow['senddate'],$reArr['title'],$arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename'],$arcRow['moresite'],$arcRow['siteurl'],$arcRow['sitepath']);return$Url;} |
到此这篇关于dedecms 调用指定栏目,指定作者,指定自定义字段就介绍到这了。把花融进心海,有一句是为你心开,把祝福散落人海,有一种是为你归来,把温暖折成花海,有一朵是为你存在。大雪节气到来,好运来。更多相关dedecms 调用指定栏目,指定作者,指定自定义字段内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!