产品使用及交流论坛

首页 » 产品使用交流区 » 安装及使用交流 » 【分享】如何在文章标题后加new
千羽网络 - 2014/2/18 13:30:20
        看到有人在问如何加new,想想自己也是从xiyou版主的帖子那学来的,何不借花献佛,分享一下?大致流程按以下图片顺序进行即可,具体代码可以搜一下xiyou大神的帖子,再次感谢xiyou的热心解答。
6095


6096


6097


6098
xuridongsheng - 2014/2/18 15:56:54
谢谢楼主,弄好啦,可是为什么后面的日期没有啦
6100
xuridongsheng - 2014/2/18 15:57:55
是不是new图标和日期不能同时存在呀,还请楼主赐教,谢谢啦
xiyou - 2014/2/18 16:11:46
加在</a></span>的中间,不要放标签后面
xuridongsheng - 2014/2/19 8:27:51
多谢版主,弄好啦
千羽网络 - 2014/2/19 11:14:05
其实我也不懂,还是xiyou大神厉害,谢谢又学到了。
leslie - 2014/4/17 15:14:30
非常好!学习了!
yt001 - 2014/10/19 20:35:59
这个可以有!马上修改测试效果!
lwx83 - 2014/10/27 22:48:11
我要试一下
红脸猫 - 2015/1/15 21:56:06
为什么我按照楼主所说的做了后刷新页面变成了
Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'newpic' does not exist in the current context

Source Error:


[No relevant source lines]

Source File:    Line: 0
wahuan - 2015/1/27 9:36:30
看看看
77098227 - 2015/2/3 14:16:55
能说得详细点吗
77098227 - 2015/2/6 21:42:44
shool 5应该改哪个表
yunzhongke - 2015/2/6 22:41:50
非常好,看起来醒目多了!
8594

附件: QQ截图20150206224041.jpg
RdongC - 2016/5/4 13:39:09
学习了,效果很棒
xiangbin0326 - 2017/2/19 12:25:51
导航模型
12695


[attachimg]12694[/attachimg]



<script Language="c#" Runat="server">

string newpic(DateTime D1)

     {

        string rv="";

        TimeSpan ts=DateTime.Now-D1;

        if(ts.Days<=3)  //如果是3天内发布就返回图片,这里可以自己修改

         {

           rv="<img src='/e/images/diy/new.gif' hspace=5>";

         }

        return rv;

     }

</script>




<ul class="fcxx">
<%
string Line;

DataTable dt=Get_Data();
DataRow dr;
for(int i=0;i<dt.Rows.Count;i++)
{
dr=dt.Rows;
if(((i+1)%5)==0)
{
  Line="<li class='line'></line>";
}
else
{
  Line="";
}
%>


<li><span class="title">



<a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode
(dr["title"].ToString())%>style="<%=dr["title"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%>
</a>

</span>
<span class="date"><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%></span>
<%=newpic((DateTime)dr["thedate"])%>

<span class="clear"></span>
</li>
<%
}
%>
</ul>
  以上是需要显示最新标志的栏目及代码所放的位置,咋没显示呢?求指教,谢谢!
1
查看完整版本: 【分享】如何在文章标题后加new