主题 : 如何取广告位图片
级别: 举人
UID: 126517
积分:100 加为好友
威望: 0 精华: 0
主题:15 回复:66
注册时间:2018-11-01
在线时长:0
1#   发表于:2019-11-14 11:38:57  IP:1.71.*.*
[@cms_advertising id='1']
[#if tag_bean.enabled!]
<a href="${( tag_bean.attr.image_link)!}" target="${ tag_bean.attr.image_target!}" title="${(tag_bean.attr.image_title)!}">
<img src="${tag_bean.attr.image_url}" border="0"[#if (tag_bean.attr.image_width)??] width="${tag_bean.attr.image_width}"[/#if][#if (tag_bean.attr.image_height)??] height="${tag_bean.attr.image_height}"[/#if] alt=${tag_bean.endTime!} ${tag_bean.startTime!}/>
</a>
[/#if]
[/@cms_advertising]


用这段可以取出启用了的广告位图片,但是设置的结束时间已经结束的广告也会被取到。
该如何判断时间。
级别: 论坛管理员
UID: 122721
积分:57884 加为好友
威望: 2 精华: 1
主题:5 回复:50085
注册时间:2018-05-07
在线时长:0
2#   发表于:2019-11-14 11:39:57  IP:117.152.*.*
您那边是什么版本的项目?
每天告诉自己一次,“我真的很不错”。
级别: 举人
UID: 126517
积分:100 加为好友
威望: 0 精华: 0
主题:15 回复:66
注册时间:2018-11-01
在线时长:0
3#   发表于:2019-11-14 11:49:35  IP:1.71.*.*
V9.3的授权版本
级别: 论坛管理员
UID: 122721
积分:57884 加为好友
威望: 2 精华: 1
主题:5 回复:50085
注册时间:2018-05-07
在线时长:0
4#   发表于:2019-11-14 11:56:54  IP:117.152.*.*
您好   你可以看下v9的美工文档   里面是有广告调用例子的
每天告诉自己一次,“我真的很不错”。
级别: 举人
UID: 126517
积分:100 加为好友
威望: 0 精华: 0
主题:15 回复:66
注册时间:2018-11-01
在线时长:0
5#   发表于:2019-11-14 17:11:18  IP:1.71.*.*
美工手册里的例子太简单了,连广告是否启用的判定都没有,更没有到期时间的判定。
[@cms_advertising id='1'] 
[#if tag_bean??]
[#if tag_bean.category=="image"]
[#assign html]
<a href="${( tag_bean.attr.image_link)!}" target="${ tag_bean.attr.image_target!}" title="${(tag_bean.attr.image_title)!}">
<img src="${tag_bean.attr.image_url}" border="0"[#if (tag_bean.attr.image_width)??] width="${tag_bean.attr.image_width}"[/#if][#if (tag_bean.attr.image_height)??] height="${tag_bean.attr.image_height}"[/#if]/>
</a>
[/#assign]
${html!}
[#elseif tag_bean.category=="flash"]
[#assign html]
<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" menu="true"
 src="${(tag_bean.attr.flash_url)!}"[#if tag_bean.attr.flash_width?? && tag_bean.attr.flash_width!=""] width="${tag_bean.attr.flash_width}"[/#if][#if tag_bean.attr.flash_height?? && tag_bean.attr.flash_height!=""] height="${tag_bean.attr.flash_height}"[/#if]></embed>
[/#assign]
${html!}
[#elseif tag_bean.category=="text"]
[#assign html]
<a href="${(tag_bean.attr.text_link)!}" target="${(tag_bean.attr.text_target)!}">
<span style="[#if (tag_bean.attr.text_color)??]color:${tag_bean.attr.text_color};[/#if][#if (tag_bean.attr.text_font)??]font-size:${tag_bean.attr.text_font};[/#if]">${(tag_bean.attr.text_title)!}</span>
</a>
[/#assign]
${html!}
[#elseif tag_bean.category=="code"]
${tag_bean.code!}
[#else]
未知的广告类型:${tag_bean.category!}
[/#if]
[#else]
广告不存在"
[/#if]
[/@cms_advertising] 

这些只是判定广告类型并显示,没有是否启用、是否过期的判断。
现在想知道是否过期的判断要怎么写。
tag_bean.endTime是一个date类型,要怎么比较。
级别: 论坛管理员
UID: 122721
积分:57884 加为好友
威望: 2 精华: 1
主题:5 回复:50085
注册时间:2018-05-07
在线时长:0
6#   发表于:2019-11-14 17:17:44  IP:117.152.*.*
您好   我需要去了解下
每天告诉自己一次,“我真的很不错”。
1 共1页