Recently, I am engaged in the Empire cms. If the article contains images or the article is top-notch, I need to display the corresponding logo in the header of the list. Then I implemented it with the smart tag. Here I will record some, it is estimated that many people will use it.
We output the information with the new icon Based on the release within 3 days (the Smart tag format on the homepage template ):
[E: loop = {topic ID, number of entries displayed, operation type, only title images displayed}] <? $ Newimg = ""; if (time ()-$ bqr [truetime] <= 3*24*3600) {$ newimg = " <Li> <a href = "<? = $ Bqsr [titleurl]?> "Title =" <? = $ Bqr [title]?> "Target =" _ blank "> <? = Esub ($ bqr [title], 36)?> </A> <? = $ Newimg?> </Li> [/e: loop]
Note: The field value array variable is $ bqr, and the corresponding field variable is $ bqr [field name]. For example, the title field variable is $ bqr [title].
First, select "use program code" on the list template. We recommend that you output information with the new icon (list Page Template [list content template (list. var)] format ):
$ Newimg = "; if ($ r [isgood] = 1) {$ newimg = ' ';} $ listtemp = '<li> <a href = "[! -- Titleurl --] "title = "[! -- Oldtitle --] "> [! -- Title --] </a> '. $ newimg.' </li> ';
Note: The field value array variable is $ r, and the corresponding field variable is $ r [field name]. For example, the title field variable is $ r [title]. The variable '. $ newimg.' is also defined .'. Assign the final template content to the $ listtemp variable.
For more information about condition collection on homepage templates, see:
If ($ bqr [isgood] = 1) // recommended if ($ r [firsttitle] = 1) // toutiao if ($ r [istop] = 1) // set the top if ($ bqr [isgood] = 1 & $ bqr [firsttitle] = 1 & $ bqr [istop] = 1) // top-toutiao.com-recommendation (Combined Use)
Finally, the actual code is provided:
[E: loop = {'selfinfo ', 20, 0, 0}] <? $ Newimg = ""; $ good = ""; if (! Empty ($ bqr [titlepic]) {$ newimg = " <Tr class = "even"> <td class = "title">