Common tags such as random calls in the CMS document

Source: Internet
Author: User

Display information click ranking within one week

[E: loop = {'News', 10, 18, 0, 'newstime> unix_timestamp ()-86400 * 7', 'onclick desc'}]
<A href = "<? = $ Bqsr [titleurl]?> "Target =" _ blank "> <? = $ Bqr [title]?> </A> <br>
[/E: loop]


How many days of new information can be displayed with a smart tag technique?

<Table>
[E: loop = {Column ID, number of entries displayed, operation type, only show with title image}]
<?
$ Newimg = "";
If (Time ()-$ bqr [truetime] <= 3*24*3600)
{
$ Newimg = " ";
}
?>
<Tr> <TD>
<A href = "<? = $ Bqsr [titleurl]?> "Target =" _ blank "> <? = Esub ($ bqr [title], 36)?> </A> <? = $ Newimg?>
</TD> </tr>
[/E: loop]
</Table>

Random call by table: [ecmsinfo] "select * From phome_ecms_news order by rand () DESC limit 6", [/ecmsinfo]
Randomly call this topic: [ecmsinfo] "select * From phome_ecms_news where classid = '$ globals [navclassid] 'order by rand () DESC limit 6, 2, 0 [/ecmsinfo]
Where: news is the table name, two 6 indicates that the number of calls is 6, 18 indicates that the title is 18 characters, and the first 0 indicates that the column name is not displayed, the Operation Type of the random call is fixed to 24, 2 indicates the template ID, and the second 0-title image does not exist.

<? PHP
$ Randnum = 10; // random quantity
$ Randids = '';
$ Randdh = '';
For ($ I = 1; $ I <= $ randnum; $ I ++)
{
$ Randids. = $ randdh. Rand (100000); // 1 is the minimum ID and is the maximum ID
$ Randdh = ',';
}
?>
[E: loop = {Column ID, number of items displayed, operation type, only the title image is displayed, "ID in ($ randids)"}]
Template code content
[/E: loop]

In addition, when searching on the Forum, I learned that a random call to a topic should be of the following types:
[Ecmsinfo] "select * From phome_ecms_article where classid = 'id name' order by rand () DESC limit 6", [/ecmsinfo]
[Ecmsinfo] "select * From phome_ecms_news where classid in (id1, Id2, id3. ..) order by rand () DESC limit 6", [/ecmsinfo]
......
However, when I tested it myself, I found that the test could not be successful, and it was unclear why,

Call news with the title containing "CMS"
[E: loop = {'News', 0, "title like '% CMS %'", ''}]
<A href = "<? = $ Bqsr [titleurl]?> "Target =" _ blank "> <? = $ Bqr [title]?> </A> <br>
[/E: loop]

[Copying and imitating new users]

Call the latest 10 posts of the Forum:
<Div>
<Ul>
[E: loop = {"select tid, subject from cdb_threads order by tid desc limit 10", 10, 24, 0}]
<Li> <a href = "http://www.nuopu.net/bbs/viewthread.php? Tid = <? = $ Bqr [TID]?> "Target =" _ blank "> <? = Sub ($ bqr [subject], 0, 40, false)?> </A> </LI>
[/E: loop]
</Ul>
</Div>

Explanation for beginners who do not know SQL:
Select tid, subject from cdb_threads order by tid desc limit 10 ", 10, 24, 0
This sentence means:
Select tid and subject from the data table cdb_threads, and sort 10 data items by TID.
<Li> <a href = "http://www.paomei.net/bbs/viewthread.php? Tid = <? = $ Bqr [TID]?> "Target =" _ blank "> <? = Sub ($ bqr [subject], 0, 40, false)?> </A> </LI>
<? = $ Bqr [TID]?> It indicates the TID field in the data table cdb_threads,
<? = Sub ($ bqr [subject], 0, 40, false)?> It indicates that the field "subject" in the data table "cdb_threads" is displayed, and 40 characters (that is, 20 Chinese characters) are truncated.

The above explanations are easy to understand, right? It doesn't matter if you don't understand the code. You just need to copy and paste what you don't understand as a Chinese character you don't know.

10 excellent posts from the Forum are called in order:
<Div>
<Ul>
[E: loop = {"select tid, subject from cdb_threads where digest <> 0 order by tid desc limit 10", 10, 24, 0}]
<Li> <a href = "http://www.99800.cn/bbs/viewthread.php? Tid = <? = $ Bqr [TID]?> "Target =" _ blank "> <? = Sub ($ bqr [subject], 0, 40, false)?> </A> </LI>
[/E: loop]
</Ul>
</Div>

As above, the difference is that the where digest <> 0 is used to select a post with digest;

The 10 most visited posts in the Forum are called in the order of access:
<Div>
<Ul>
[E: loop = {"select tid, subject from cdb_threads order by views DESC limit 10", 10, 24, 0}]
<Li> <a href = "http://www.qikuai.net/bbs/viewthread.php? Tid = <? = $ Bqr [TID]?> "Target =" _ blank "> <? = $ Bqr [subject]?> </A> </LI>
[/E: loop]
</Ul> </div>

Top forums:
<Div>
<Ul>
[E: loop = {"select FID, name from cdb_forums order by threads DESC limit 10", 10, 24, 0}]
<Li> <a href = "http://www.010k.net/bbs/forumdisplay.php? FID = <? = $ Bqr [FID]?> "Target =" _ blank "> <? = $ Bqr [name]?> </A> </LI>
[/E: loop]
</Ul> </div>

FID, name, and threads are the three fields in the DZ Forum data table cdb_forums, representing the Forum section ID, Forum section name, and posts in the Forum section.
So the above Code means:
Call the ID and name data in the data table cdb_forums with the smart label, and arrange them according to the number of threads; the call content FID is assigned to the <a href = "http://www.xxx.com/bbs/forumdisplay.php? FID = <? = $ Bqr

[FID]?> "In FID, the name of the called field is assigned to <? = $ Bqr [name]?> That is, the section name displayed in the foreground template.

The preceding three simple examples show that smart tags can directly call fields in the database and use an SQL statement to read the fields. If an error occurs, the most common reason is that the data table does not exist, that is, you

The data table is not set. Generally, the discuz Forum installed by default does not need to modify the above Code.

The above is my personal experience. I do not know the SQL language or the PHP language, so I will have a little simple HTML and simple English. I have read the following posts and I would like to express my gratitude here!
Http://bbs.phome.net/ShowThread? Threadid = 29390 & forumid = 35 [This is an example of calling with a universal label]
Http://bbs.phome.net/ShowThread? Threadid = 80318 & forumid = 13
It seems that I have read other things. I used the Empire forum to search for related posts one by one. Then I tried these things again and finally got these things done.


[E: loop = {"select uid, username from uchome_space order by credit DESC limit 9", 9, 24, 0}]
<Div> <a href = "http://www.jqap.com/home/space.php? Uid = <? = $ Bqr [uid]?> "Target =" _ blank ">
> & Size = Small & type = real "width =" 48px "Height =" 48px "> </a> </div>
<Div> <a href = "http://www.jqap.com/home/space.php? Uid = <? = $ Bqr [uid]?> "Target =" _ blank "> <? = $ Bqr [username]?> </A> </div>
[/E: loop]

Nothing left.
I also shared the code for calling the uchome Smart tag to display member portraits.
I did not go to bed all night, so I found this thing.
Hot member profile pictures, latest logs, latest topics, records, and codes are all similar. Just replace some fields on your own.
Basically, I have called all the calls that discuz uchome can call.

Let me share it with you.
The following is the latest information about the forum.
[Ecmsinfo] 'select subject as title, tid as ID from cdb_threads order by tid desc limit 10', [/ecmsinfo]

Other parameters will not be mentioned.
The teaching materials of the empire are very detailed.
Call the post information of a specific topic
[Ecmsinfo] 'select subject as title, tid as ID from discuz5.cdb _ Threads Where FID = here is the FID order by tid desc limit 10, 0, 24, 7, 0 [/ecmsinfo]

Call posts of multiple sections
[Ecmsinfo] 'select subject as title, tid as ID from discuz5.cdb _ Threads Where FID = number or FID = number order by tid desc limit 10, 7, 0 [/ecmsinfo]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.