Here is not the Dizcuz background JS call method, that one is not very good according to their own needs typesetting, the second is not friendly to search engines. This is the loop tag pattern.
Copy Code code as follows:
Get the contents of any table
function gettable ($tablename = "", $row =6, $sort = "", $ifcase = "", $InnerText = "") {
$InnerText = Trim ($InnerText);
if ($tablename = = "" | | $InnerText = = "") return "";
$row = Attdef ($row, 6);
if ($sort!= "") $sort = "ORDER by $sort Desc";
if ($ifcase!= "") $ifcase = "where $ifcase";
$revalue = "";
$this->dsql->setquery ("select * from $tablename $ifcase $sort limit 0, $row");
$this->dsql->execute ();
$CTP = new Dedetagparse ();
$CTP->setnamespace ("Field", "[", "]");
$CTP->loadsource ($InnerText);
while ($row = $this->dsql->getarray ())
{
foreach ($ctp->ctags as $tagid => $ctag) {
if (!empty ($row [$ctag->getname ()])
{$CTP->assign ($tagid, $row [$ctag->getname ()]);}
}
$revalue. = $ctp->getresult ();
}
return $revalue;
}
From the above code to see if the parameter is actually a judgment statement, you can refer to the table for arbitrary output
1 Forum Latest Topic call method:
Code
{dede:loop table= "cdb_threads" sort= "Tid" row= "10"}
<a href= "/dz/viewthread.php?tid=[field:tid/]" >
· [Field:subject function= "Cn_substr (' at me ', 30)"/] ([Field:lastpost function= "date (' m-d h:m ', ' @me ')")
</a>
<br/>
{/dede:loop}
2 forum to specify the way to invoke:
{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 (' at me ', 50)"/]
</a>
<br/>
{/dede:loop}
3 Forum Call Method 2:
{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 (' at me ')"/]</a> <br>
{/dede:loop}
4 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 (' at me ', 30)"/]
</a>
{/dede:loop}
Note: This is still a problem, it will be the Forum division, the section are transferred out.
Attachment: Loop tagging rules for DEDECMS
Function Description: Used to call any table of data, generally used to invoke forum posts and such operations
Scope of application: all templates
(1) Basic grammar
{dede:loop table= ' sort= ' row= ' if= '}
Underlying template
{Dede:loop}
(2) Property
[1] table represents the data table for the query
[2] Sort the fields used for sorting
[3] Row returns the result of the number of bars
[4] If query condition
(3) Underlying template variables
The underlying template variable for this tag is all the fields of the table being queried
===========================================
Forum Latest Theme:<br/>
{dede:loop table= "cdb_threads" if= "fid=9 and Displayorder!=-1" sort= "Tid" 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}