注:字段值數組變量為$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]
新聞熱點
疑難解答