麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 網(wǎng)站 > 建站經(jīng)驗 > 正文

列表頁(list.var)判斷推薦、頭條、置頂,并加(推薦、頭條、置頂圖)

2024-04-25 20:54:58
字體:
供稿:網(wǎng)友
說明:
1、首先注意開啟置頂:后臺 》 系統(tǒng) 》 系統(tǒng)參數(shù)設(shè)置 》 信息設(shè)置 》 信息置頂設(shè)置 ,選擇 欄目/標簽置頂
2、使用的代碼
①、調(diào)用幾級推薦、頭條、置頂 ,如下調(diào)用的都是一級的推薦、頭條、置頂 
if(!empty($bqr[titlepic])) //圖片 
if($bqr[isgood]==1) //推薦 
if($r[firsttitle]==1) //頭條 
if($r[istop]==1) //置頂 
if($bqr[isgood]==1&&$bqr[firsttitle]==1&&$bqr[istop]==1) //置頂-頭條-推薦 (組合使用) 

②、調(diào)用全部的推薦、頭條、置頂(即:把“==1”修改為“>0”)
if(!empty($bqr[titlepic])) //圖片 
if($bqr[isgood]>0) //推薦 
if($r[firsttitle]>0) //頭條 
if($r[istop]>0) //置頂 
if($bqr[isgood]>0&&$bqr[firsttitle]>0&&$bqr[istop]>0) //置頂-頭條-推薦 (組合使用) 
---------------------------------------------------------------------------------------------
方法1、判斷各自的(有兩個或兩個以上的屬性,也只顯示一個屬性),即:只顯示一個圖

注釋:如一個信息有“推薦”和“頭條”兩個屬性,下面的代碼也只能讓其顯示一個屬性(那個屬性在前就先顯示那個)
<?=$newimg?>可以是圖片 $newimg="<img src='dg2/e/data/images/saypl.gif' />"; 

舉例:

$r[title]=esub($r[title],27,'...');
$newimg=""; 
if($r[istop]==1)
{
$newimg="<font color=red>[頂]</font>";
}
elseif($r[isgood]==1)  
{
$newimg="<font color=red>[薦]</font>";
}
elseif($r[firsttitle]==1)  
{
$newimg="<font color=red>[頭]</font>";
}

$listtemp='

<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>

';

注釋:$newimg=""; newimg為空     
      if($r[istop]==1){$newimg="<font color=red>[頂]</font>";     當istop=1時,newimg顯示“[頂]”

php部分還可以這樣寫判斷  格式:if -> elseif -> else   意思:“判斷” 或 “2判讀” 否則  “為空”
  實際上就是把$newimg=""; 用else放到了最下面

實例:
$r[title]=esub($r[title],27,'...');
if($r[istop]==1)
{
$newimg="<font color=red>[頂]</font>";
}
elseif($r[isgood]==1)  
{
$newimg="<font color=red>[薦]</font>";
}
elseif($r[firsttitle]==1)  
{
$newimg="<font color=red>[頭]</font>";
}
else
{
$newimg="";
}
$listtemp='

<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>

';


-------------------------------------------------------------------------------
方法2、判斷各自的(有兩個或兩個以上的屬性,可顯示多個屬性),即:可顯示多個圖。在上面代碼的基礎(chǔ)上組合了個“兩個的屬性”,即:一個信息兩張圖
      
注釋:如一個信息有“推薦”和“頭條”兩個屬性,在上面的代碼基礎(chǔ)上加了一個判斷的語句把“推薦”和“頭條”組合在一起可以顯示雙屬性的屬性語句。
即:一條信息同時顯示“推薦”和“頭條”兩個屬性
<?=$newimg?>可以是圖片 $newimg="<img src='dg2/e/data/images/saypl.gif' />";


舉例:
$r[title]=esub($r[title],27,'...');
$newimg=""; 
if($r[isgood]==1&&$r[firsttitle]==1) 
{
$newimg="<font color=red>[推薦]</font> &nbsp;<font color=red>[頭條]</font>";   
}
elseif($r[isgood]==1)  
{
$newimg="<font color=red>[推薦]</font>";
}
elseif($r[firsttitle]==1)  
{
$newimg="<font color=red>[頭條]</font>";
}
$listtemp='

<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】'.$newimg.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>

';

注釋:$newimg=""; newimg為空     
      if($r[istop]==1){$newimg="<font color=red>[頂]</font>";     當istop=1時,newimg顯示“[頂]”

php部分還可以這樣寫判斷  格式:if -> elseif -> else   意思:“判斷” 或 “2判讀” 否則  “為空”
  實際上就是把$newimg=""; 用else放到了最下面

實例:同上
------------------------------------------------------------------------------------------------------------------

方法3、判斷各自的,(有兩個或兩個以上的屬性,可顯示多個屬性),即:可顯示多個圖。各自加各自的圖,即:每個屬性上多能加多張圖
<?=$newimg?>可以是圖片 $newimg="<img src='dg2/e/data/images/saypl.gif' />";

$r[title]=esub($r[title],27,'...');
$newimg="";
$top="";
$good="";
$ttitle="";
if(!empty($r[titlepic])) 

$newimg="<font color=red>[圖片]</font>"; 

if($r[istop]==1) 

$top = "<font color=red>[置頂]</font>"; 

if($r[isgood]==1) 

$good = "<font color=red>[推薦]</font>"; 

if($r[firsttitle]==1) 

$ttitle = "<font color=red>[頭條]</font>"; 

$listtemp='

<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】&nbsp;'.$newimg.' &nbsp;'.$top.'&nbsp;'.$good.'&nbsp;'.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>

';


注釋:$newimg="";、$top="";、$good="";、$ttitle=""; 各自為空     
      [titlepic]、[istop]==1、[isgood]==1、[firsttitle]==1      當=1時,各自顯示各自的圖
     
php部分還可以這樣寫判斷  格式:if ->  else   意思:“判斷”  否則  “為空”
  實際上就是把$newimg=""; 用else放到了最下面

實例:
$r[title]=esub($r[title],27,'...');
if(!empty($r[titlepic])) 

$newimg="<font color=red>[圖片]</font>"; 

else
{
$newimg='';
}
if($r[istop]==1) 

$top = "<font color=red>[置頂]</font>"; 

else
{
$top='';

if($r[isgood]==1) 

$good = "<font color=red>[推薦]</font>"; 

else
{
$good='';

if($r[firsttitle]==1) 

$ttitle = "<font color=red>[頭條]</font>"; 
}
else
{
$ttitle='';
}  
$listtemp='

<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】&nbsp;'.$newimg.' &nbsp;'.$top.'&nbsp;'.$good.'&nbsp;'.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>

';



---------------------------------------實例-----------------------------------------------

圖片、置頂、一級二級推薦、一級二級頭條

php部分還可以這樣寫判斷  格式:if -> elseif -> else   意思:“判斷” 或 “2判讀” 否則  “為空”
  實際上就是把$newimg=""; 用else放到了最下面

<br>------------------方法1----------------------<br>
$r[title]=esub($r[title],27,'...');
$newimg="";
$top="";
$good=""; 
$ttitle="";
if(!empty($r[titlepic])) 

$newimg="<font color=red>[圖片]</font>"; 

if($r[istop]==1) 

$top = "<font color=red>[置頂]</font>"; 

if($r[isgood]==1) 

$good = "<font color=red>[推薦]</font>"; 

elseif($r[isgood]==2)  
{
$good="<font color=red>[推薦2]</font>";
}
if($r[firsttitle]==1) 

$ttitle = "<font color=red>[頭條]</font>"; 

elseif($r[firsttitle]==2)  
{
$ttitle="<font color=red>[頭條2]</font>";
}
$listtemp='

<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】&nbsp;'.$newimg.' &nbsp;'.$top.'&nbsp;'.$good.'&nbsp;'.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>

';


方法1:PHP部分的格式:為空 -> if -> elseif


<br>------------------方法2----------------------<br>
$r[title]=esub($r[title],27,'...');
if(!empty($r[titlepic])) 

$newimg="<font color=red>[圖片]</font>"; 

else
{
$newimg='';

if($r[istop]==1) 

$top = "<font color=red>[置頂]</font>"; 

else
{
$top='';

if($r[isgood]==1) 

$good = "<font color=red>[推薦]</font>"; 

elseif($r[isgood]==2)  
{
$good="<font color=red>[推薦2]</font>";
}
else
{
$good='';

if($r[firsttitle]==1) 

$ttitle = "<font color=red>[頭條]</font>"; 

elseif($r[firsttitle]==2)  
{
$ttitle="<font color=red>[頭條2]</font>";
}
else
{
$ttitle='';

$listtemp='

<li>【'.$class_r[$r[classid]]['classname'].' 】【[!--this.classname--]】&nbsp;'.$newimg.' &nbsp;'.$top.'&nbsp;'.$good.'&nbsp;'.$ttitle.' <a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> <span>[!--newstime--]</span></li>

';


方法2:PHP部分的格式:if -> elseif -> else
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 国产精选91 | 婷婷一区二区三区四区 | 久久精品男人 | 一边吃奶一边插下面 | 欧美一级做性受免费大片免费 | 欧美大片一级毛片 | 成人三区四区 | 黄色网电影 | 成人福利在线视频 | 色综合网在线观看 | 国产瑟瑟视频 | 91福利在线观看 | 在线91视频 | 欧美一区在线观看视频 | 欧洲成人一区二区 | 日韩电影一区二区 | 欧美亚洲黄色 | 一级做a爰片性色毛片2021 | 亚洲精品免费播放 | 国产成人高清在线观看 | 91av在线影院 | 免费国产一级特黄久久 | av观看国产| 久久精品亚洲国产奇米99 | 中文字幕在线观看91 | 国产艳妇av视国产精选av一区 | 久久精品视频7 | 国产精品久久久久国产精品三级 | 国产精品久久久久久久久久久久久久久久 | 中文字幕精品一区久久久久 | 久久久久久久久久久久久久av | 国产日韩欧美 | 91成人天堂久久成人 | 黄色av电影在线播放 | 国产在线播放一区二区 | 国产精品嘿咻嘿咻在线播放 | 免费一级在线观看 | 亚洲精品欧美在线 | 欧美中文字幕一区二区 | 欧美日韩爱爱视频 | 成人不卡 |