注:字段值数组变量为$bqr,对应的字段变量为$bqr[字段名],如:标题字段变量就是$bqr[title]。01 [e:loop={栏目ID,显示条数,操作类型,只显示有标题图片}]
02 <?
03 $newimg="";
04 if(time()-$bqr[truetime]<=3*24*3600)
05 {
06 $newimg="<img src='New图片地址'>";
07 }
08 ?>
09 <li>
10 <a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>" target="_blank"><?=esub($bqr[title],36)?></a><?=$newimg?>
11 </li>
12 [/e:loop]
注:字段值数组变量为$r,对应的字段变量为$r[字段名],如:标题字段变量就是$r[title]。另外定义的变量为'.$newimg.' 。将最终模板内容赋给$listtemp变量。1 $newimg=";
2 if($r[isgood]==1)
3 {
4 $newimg='<img src='New图片地址'>';
5 }
6 $listtemp='<li><a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a>'.$newimg.'</li>';
1 if($bqr[isgood]==1) //推荐
2 if($r[firsttitle]==1) //头条
3 if($r[istop]==1) //置顶
4 if($bqr[isgood]==1&&$bqr[firsttitle]==1&&$bqr[istop]==1) //置顶-头条-推荐 (组合使用)
最后给出实际使用中的代码:
view sourceprint?
01 [e:loop={'selfinfo',20,0,0}]
02 <?
03 $newimg="";
04 $good="";
05 if(!empty($bqr[titlepic]))
06 {
07 $newimg="<img src='' />";
08 }
09 if($bqr[istop]==1)
10 {
11 $good = "<img src='' />";
12 }
13 ?>
14 <tr class="even">
15 <td class="title">
16 <h1><a href="<?=$bqsr[titleurl]?>" target="_blank"><?=sub($bqr[title],0,30,false)?></a> <?=$newimg?> <?=$good?></h1>
17 <p class="intro">
18 <?=sub($bqr[smalltext],0,80,false)?>[<a title="阅读全文" href="<?=$bqsr[titleurl]?>" target="_blank">详细内容</a>]
19 </p>
20 </td>
21 <td><?=$bqr[myarea]?></td>
22 <td><?=date('Y-m-d H:i:s', $bqr[newstime])?></td>
23 </tr>
24 [/e:loop]
新闻热点
疑难解答