帝国cms 列表内容模板两种样式切换遍历

2023-12-01 0 402

if($no%2 != 0){$lstemp='<li><divclass="case-l fl fadeInDown wow"><img src="'.$r[titlepic].'"></div><divclass="case-r fr fadeInUp wow"data-wow-delay="0.5s"><divclass="case-rnr"><h1>'.$r[title].'</h1><p>'.$r[smalltext].'</p><a href="'.$r[titleurl].'">MORE >></a></div></div></li>';}else{$lstemp='<liclass="case01"><divclass="case-r fl fadeInDown wow"><divclass="case-rnr"><h1>'.$r[title].'</h1><p>'.$r[smalltext].'</p><a href="'.$r[titleurl].'">MORE >></a></div></div><divclass="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><divclass="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><divclass="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";

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 帝国CMS教程 帝国cms 列表内容模板两种样式切换遍历 https://www.u-9.cn/jiaocheng/empirecms/15085.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务