if($no%2 != 0){ $lstemp='<li> <div class="case-l fl fadeInDown wow"> <img src="'.$r[titlepic].'"> </div> <div class="case-r fr fadeInUp wow" data-wow-delay="0.5s"> <div class="case-rnr"> <h1>'.$r[title].'</h1> <p>'.$r[smalltext].'</p> <a href="'.$r[titleurl].'">MORE >></a> </div> </div> </li>';}else{ $lstemp='<li class="case01"> <div class="case-r fl fadeInDown wow"> <div class="case-rnr"> <h1>'.$r[title].'</h1> <p>'.$r[smalltext].'</p> <a href="'.$r[titleurl].'">MORE >></a> </div> </div> <div class="case-l fr fadeInUp wow" data-wow-delay="0.5s"> <img src="'.$r[titlepic].'"> </div> </li>';
}
$listtemp="$lstemp";
記得開啟列表內容模板的使用程序代碼
切換遍歷的同時也可以調取發布時間(年月日)
$newstime=$r[newstime];//獲取信息發布時間$year=format_datetime($newstime,"Y");//單獨獲取年$month=format_datetime($newstime,"m");//單獨獲取月$day=format_datetime($newstime,"d");//單獨獲取日 if($no%2 != 0) { $lstemp='<li> <a href="'.$r[titleurl].'" class="zlhzPic fl"> <img src="'.$r[titlepic].'"> </a> <div class="zlhzTxt fr"><a href=""> <h1>'.$r[title].'</h1> <span>'.$year.'-'.$month.'-'.$day.'</span> /*這里就是獲取文章發布的年 月 日*/ <p> '.$r[smalltext].' </p> <h2>查看詳情</h2> </a> </div> </li>'; }else{ $lstemp='<li> <div class="zlhzTxt fl"><a href="'.$r[titleurl].'"> <h1>'.$r[title].'</h1> <span>'.$year.'-'.$month.'-'.$day.'</span> <p> '.$r[smalltext].' </p> <h2>查看詳情</h2> </a> </div> <a href="'.$r[titleurl].'" class="zlhzPic fr"> <img src="'.$r[titlepic].'"> </a> </li>'; } $listtemp="$lstemp";






