帝国CMS列表页判断是否有标题图片,有标题图一种样式,无标题图的另一种样式。
效果演示
帝国CMS列表页判断是否有标题图代码
123456789101112131415 | $listtemp=''; $listtemp='< dl >< dd > < h2 >< a target = _blank href=[!--titleurl--]>[!--title--]</ a ></ h2 > < p >[!--smalltext--]...< a href=[!--titleurl--]>【阅读全文】</ a ></ p > </ dd > </ dl >'; if(empty($r[titlepic])) { $listtemp='< dl >< dt >< a target = _blank href=[!--titleurl--]>< img alt=[!--title--] title=[!--title--] src=[!--titlepic--]/></ a ></ dt > < dd > < h2 >< a target = _blank href=[!--titleurl--]>[!--title--]</ a ></ h2 > < p >[!--smalltext--]...< a href=[!--titleurl--]>【阅读全文】</ a ></ p > </ dd > </ dl >'; } |
为了方便新手能看懂,简化下。
123456 | $listtemp=''; $listtemp='< p class = "h1" >有标题图的代码放这里</ p >'; if(empty($r[titlepic])) { $listtemp='< p >无标题图的代码放这里</ p >'; } |
最后记得勾选“使用程序代码”
完成。
标签 帝国CMS判断