Intermediary transaction SEO diagnosis Taobao guest Cloud host technology Hall
Today I tell you some in the weaving dream dedecms inside call Discuz forum post Some methods, these methods are not easy to search from the Internet, this time dedicated to everyone.
The first thing to note is that the following code has table= "Cdb_threads" this sentence. This sentence is not applicable to all sites, this local CBD is your forum table prefix name, everyone according to their own forum modified to the appropriate table prefix name. Furthermore, I put the Dream and Discuz forum in a database, just began to put in two databases, integrated a half-day unsuccessful, do not know what the reason. Back in a database succeeded. But not in the two database to do the test, you can test, tell me the results. It is reasonable to put the same database in the same way. Finally m-d h:m with the table is released time, if as long as (day-month) time format, the h:m can be removed.
1, the forum's latest theme calling code is as follows:
{dede:loop table= "cdb_threads" sort= "Tid" row= "10"}
<a href= "/bbs/viewthread.php?tid=[field:tid/]" >
· [Field:subject function= "cn_substr (' @me ', 30)"/] ([Field:lastpost function= "date (' m-d h:m ', ' @me ')") </a>
<br/>
{/dede:loop}
You can write a relative path to this connection address, or you can write an absolute path.
If the Discuz dynamic Forum, the link address such as Http://bbs.xxx.com/viewthread.php?tid=[field:tid/]
If it is discuz static forum, the connection address such as Http://bbs.xxx.com/thread-[field:tid/]-1-1.html
2, Forum designated board post call method:
{dede:loop table= "cdb_threads" if= "fid=1 or fid=2 and displayorder!=-1" sort= "Tid" row= "6"}
<a href= "/bbs/viewthread dot Php?tid=[field:tid/]" target= "_blank" >
· [Field:subject function= "Cn_substr" (@ Me, M) "/] </a>
<br/>
{/dede:loop}
Where the fid=1 or fid=2 is the Forum topic category ID, can be modified according to their own requirements, if it is a classification directly write fid=x
3, the forum to tune the essence of the theme call code as follows:
{dede:loop table= "cdb_threads" if= "Displayorder!=-1" sort= "Tid" row= "10"}
<a href= "/bbs/viewthread.php?tid=[field:tid/]" >
· [Field:subject function= "cn_substr (' @me ', 30)"/] ([Field:lastpost function= "date (' m-d h:m ', ' @me ')") </a>
<br/>
{/dede:loop}
If you want to call a section of the essence of the theme code is as follows:
{dede:loop table= "cdb_threads" if= "fid=5 and Displayorder!=-1" sort= "Tid" row= "10"}
<a href= "/bbs/viewthread.php?tid=[field:tid/]" >
· [Field:subject function= "cn_substr (' @me ', 30)"/] ([Field:lastpost function= "date (' m-d h:m ', ' @me ')") </a>
<br/>
{/dede:loop}
The fid=5 is the Forum topic category ID, can be modified according to their own requirements,
If you want to invoke the newest essence theme of all the plates of the forum just remove fid=5 and.
4, call the list of posts this can be sorted by the number of views, the code is as follows:
{dede:loop table= "cdb_threads" sort= "views" row= "10"}
<a href= "/dz/viewthread.php?tid=[field:tid/]" >
· [Field:subject function= "cn_substr (' @me ', 30)"/] ([Field:lastpost function= "date (' m-d h:m ', ' @me ')") </a>
<br/>
{/dede:loop}
where sort= "views" is the control of the number of times to view the order of code
5, forum posts to call the top of the method examples:
{dede:loop table= "cdb_threads" sort= "Dateline" if= "fid= ' 3 ' and typeid= '" "Row=" 10 "}
<a href= "/a/bbs/viewthread dot Php?tid=[field:tid/]" target= "_blank" >
· [Field:subject function= "Cn_substr" (@ Me)/]</a> <br>
{/dede:loop}
6, Forum name call method:
{dede:loop table= "cdb_forums" sort= "Displayorder" row= "" Col= "4"}
<a href= "/bbs/viewthread dot Php?fid=[field:fid/]" > [Field:name function= "cn_substr (' @me ')"/] </a>
{/dede:loop}
Note: This method has a bit of a problem, it will be the Forum division, the section are set out. Hope Talent Improvement!
Attachment: Dedecms loop tagging rules
Function Description: Used to call any table of data, generally used to invoke forum posts and other operations
Scope of application: all templates
Basic syntax:
{dede:loop table= ' sort= ' row= ' if= '}
[1] table represents the data table for the query
[2] Sort the fields used for sorting can also be added with views
[3] Row returns the number of results
[4] If query condition
7, call forum posts in the image method, online search, I have not done the test.
{dede:sql sql= ' select ' cdb_attachments '. ' Aid ', ' cdb_attachments ', ' attachment ', ' cdb_threads ', ' tid ', ' cdb_threads '. ' FID ', ' cdb_threads '. ' Subject ' from ' cdb_attachments ' left JOIN ' cdb_threads '
On ' cdb_threads '. ' Tid ' = ' cdb_attachments '. ' Tid ' WHERE ' cdb_attachments '. ' readperm ' = ' 0 ' and ' displayorder ' >= ' 0 ' and ' ' FileType ' = ' image/pjpeg ' GROUP by tid LIMIT 0,1 '}
<a href= "/bbs/viewthread.php?tid=[field:tid/]" >
<img src= "/bbs/attachments/[field:attachment/]" alt= "[field:subject/]" width= "height=" "0" border= "/>"
</A>
{/dede:sql}
Original address: http://www.dianpu818.com/maozai/post/17.html (reprint please be sure to keep the original address)