Smart tag (e:loop)
Format:
[e:loop={栏目ID/专题ID,显示条数,操作类型,只显示有标题图片,附加SQL条件,显示排序}] 模板代码内容 [/e:loop]
Example:
<table width="100%" border="0" cellspacing="1" cellpadding="3"> [e:loop={栏目ID/专题ID,显示条数,操作类型,只显示有标题图片,附加SQL条件,显示排序}] <tr><td> <a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a> (<?=date('Y-m-d',$bqr[newstime])?>) </td></tr> [/e:loop] </table>
Tag description: Smart tags do not require a tag template, and the template content is PHP code, so it is more flexible and can use all PHP processing functions. To use this tag, you need to enable template support program code (parameter settings).
Parameters:
Variable description:
Introduction to commonly used functions:
Text interception: esub(string, interception length), example: esub($bqr[title],30) intercepts the first 30 characters of the title.
Time format: date('format string', time field), example: date('Y-m-d',$bqr[newstime]) The time display format is "2008-10-01".
This function implements the display of the New logo image when calling information if it is the latest information released that day.
<ul> [e:loop={栏目ID,显示条数,操作类型,只显示有标题图片}] <? $newimg=""; if(date("m-d",$bqr[truetime]) == date("m-d")) { $newimg = "<img src='New图片地址'>"; } ?> <li> <a href="<?=$bqsr[titleurl]?>" target="_blank"><?=sub($bqr[title],0,10,false)?></a><?=$newimg?> </li> [/e:loop] </ul>
Instructions: First define newimg as empty. If the date = today, the New picture will be displayed. Use =$newimg?> to call it at the appropriate position you want.
[e:loop={'select * from phome_ecms_news where classid=72 order by id DESC limit 6',6,24,0}], note that the second to last parameter is 24 before SQL can be used.
[e:loop={'select * from [!db.pre!]ecms_news where classid=72 and type='开发商' order by id DESC limit 6',6,24,0}] <li class="class1"> <a href='http://www.hkqipilang.acafa.com/' target=_blank title='<?=$bqr[title]?>'><?=$bqr[title]?></a> <div class="top_div_myAcafa_u"><?=$bqr[address]?><br />业务范围: <?=$bqr[smalltext]?></div> </li> [/e:loop]
[e:loop={'selfinfo',20,0,0}] <? $newimg=""; if(!empty($bqr[titlepic])) { $newimg="<img src='http://www.bkjia.com/uploads/allimg/140411/2300255O2-0.gif' />"; } ?> <tr class="even"> <td class="title"> <h1><a href="<?=$bqsr[titleurl]?>" target="_blank"><?=sub($bqr[title],0,24,false)?></a> <?=$newimg?></h1> <p class="intro"> <?=$bqr[smalltext]?>[<a title="阅读全文" href="<?=$bqsr[titleurl]?>" target="_blank">详细内容</a>] </p> </td> <td><?=$bqr[myarea]?></td> <td><?=date('Y-m-d H:i:s', $bqr[newstime])?></td> </tr> [/e:loop]
To display fields, use =$bqr[field]?>, $bqsr has just a few variables:
Except these, all others use $bqr.