3.9 应用举例 多图不同样式展示
列表内容模板(list.var) (*)
$fr=$empire->fetch1("select newstext from {$dbtbpre}ecms_news_data_{$r[stb]} where id='$r[id]'");$neirong=$fr['newstext'];$imgcount=substr_count($neirong,"<img");$listtemp='';$titlepic='';if ($imgcount>3){$tmpimg ='';$pattern='/<[img|IMG].*?src=////"(.*?(?:[/.gif|/.jpg|/.png]))////".*?[//]?>/';preg_match_all($pattern,$neirong,$match);for($j=0;$j<4;$j++){$tmpimg.='<a href="[!--titleurl--]" target="_blank"><img src="'.$match[1][$j].'"></a></p>';} $listtemp='<li> <h3 class="blogtitle"><a href="[!--titleurl--]" target="_blank">[!--title--]</a></h3> <span class="bplist">'.$tmpimg.'</span> <p class="blogtext">[!--smalltext--]... </p> <p class="bloginfo"><i class="avatar"><img src="[!--news.url--]skin/jxhx/images/avatar.jpg"></i><span>[!--writer--]</span><span>[!--newstime--]</span><span>【<a href="[!--this.classlink--]">[!--this.classname--]</a>】</span></p> </li>';} else if(empty($r[titlepic])){$listtemp='<li> <h3 class="blogtitle"><a href="[!--titleurl--]" target="_blank">[!--title--]</a></h3> <p class="blogtext">[!--smalltext--] </p> <p class="bloginfo"><i class="avatar"><script src="[!--news.url--]d/js/acmsd/thea6.js"></script></i><span>'.$writer.'</span><span>[!--newstime--]</span><span>【<a href="[!--this.classlink--]" target="_blank">'.$class_r[$r[classid]]['classname'].'</a>】</span></p> <a href="[!--titleurl--]" class="viewmore">阅读更多</a> </li>'; } else{$listtemp='<li> <h3 class="blogtitle"><a href="[!--titleurl--]" target="_blank">[!--title--]</a></h3> <span class="blogpic imgscale"><i><a href="[!--this.classlink--]">[!--this.classname--]</a></i><a href="[!--titleurl--]" title="[!--title--]"><img src="[!--titlepic--]" alt="[!--title--]"></a></span> <p class="blogtext">[!--smalltext--]... </p> <p class="bloginfo"><i class="avatar"><img src="[!--news.url--]skin/jxhx/images/avatar.jpg"></i><span>[!--writer--]</span><span>[!--newstime--]</span><span>【<a href="[!--this.classlink--]">[!--this.classname--]</a>】</span></p> </li>';}
- 上一篇
- 下一篇