sodo711 - 2017/5/17 10:11:01
如题!!
xiyou - 2017/5/17 11:02:48
sodo711 - 2017/5/18 9:34:28
看了!看不懂啊!2.0的时候真的很好用,可是3.0 就不好用了!用了如下代码,根本不管用了!<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>
xiyou - 2017/5/18 10:26:18
- <style>
- .hh_article{clear:both;} /*文章带置顶样式*/
- .hh_article li.tw{text-align:left;border:1px dotted #cccccc;border-width:0 0 1px 0;padding:5px 0 5px 0;overflow:hidden;} /*置顶通用样式*/
- .hh_article .tw .pic{float:left;margin:5px 10px 5px 0;border:1px solid #dddddd;display:inline}
- .hh_article .tw .title{text-align:left;line-height:25px;}
- .hh_article .tw .title a{font-weight:bold;padding-left:0px;font-size:14px;color: #cc0000}
- .hh_article .tw .introduct{padding:2px 5px 5px 0px;line-height:20px;color: #666666;}
- .hh_article .tw .pixc{float:right;width:30px;height:30px;border:1px solid #000}
- .hh_article li.normal{clear:both;height:40px;line-height:40px;text-align:left;overflow:hidden;}
- .hh_article .normal .title{float:left;text-align:left;padding:0 0 0 10px;background:url(images/article_arrow.gif) no-repeat left center;}
- .hh_article .normal .date{float:right;color: #666666;padding-right:2px}
- </style>
- <div class="hh_article">
- <ul>
- <%
- string pic="/e/images/diy/toip.jpg",istop="0";
- DataTable dt;
- DataRow dr;
- dt=Get_Data();
- for(int i=0;i<dt.Rows.Count;i++)
- {
- dr=dt.Rows[i];
- pic=dr["titlepic"].ToString();
- istop=dr["istop"].ToString();
- %>
- <%if(istop=="1"){%>
- <li class="tw">
- <span class="title"><a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>" style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span><span><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%></span><a href=""><img src="<%=pic%>" class="pixc"></a>
- </li>
- <%}
- else
- {%>
- <li class="normal"><span class="title">
- <a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>" style="<%=dr["pa_style"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span>
- <span class="date"><%=((DateTime)dr["thedate"]).ToString("MM-dd")%></span>
- <span class="clear"></span>
- </li>
- <%
- }
- }
- %>
- </ul></div>
复制代码
这一块放在css文件中,

这一块在表单模型中的文章资讯的模型管理中,新建一个数据模型,粘贴到里面,

这个你可以替换你想要的图片路径,

置顶是istop,最新是isnew,推荐是isgood,热门是ishot
xiangbin0326 - 2017/5/18 17:44:14
恩,xiyou老师讲解的很详细,实践证明好用!
sodo711 - 2017/5/19 15:36:02
好的 我试一下
sodo711 - 2017/5/19 16:39:46
是把CSS文件写在 comme还是 stye 或者 DIY 里面呢??
xiyou - 2017/5/19 16:41:00
comm.css文件中
mylc111 - 2017/7/14 10:14:52
xiyou:大哥,我是新手,麻烦您能写一下具体步骤和操作么?给您添麻烦了
mylc111 - 2017/7/14 10:52:53
xiyou:建立完数据模型后,在栏目模块里调用显示模型,主页就出错了
