帝国CMS列表内容模板(list.var) 调用随机图片

发布时间:2020-06-27 17:30:18www.zcabc.com 作者: 浏览:

帝国CMS列表内容模板 如何调用随机图片?

例子:调用内容标题图片 没有图片时显示随机图片

  1. if(empty($r[titlepic])){$r[titlepic]='http://www.zcabc.com/img/rand/'.rand(1,10).'.jpg';}
  2. $_nowclass=$empire->fetch1("select * from {$dbtbpre}enewsclass where classid='$r[classid]'");
  3. $listtemp='
  4. <a href="[!--titleurl--]"><img src="[!--titlepic--]" alt="[!--title--] 图片" title="[!--title--] 图片"></a>
  5. ';

tips:在/img/rand/目录下,放1.jpg,2.jpg,3.jpg……10.jpg.即可实现内容无图片时,调用随机图片功能。