PageAdmin网站内容管理系统(CMS)交流论坛

注册

 

QQ登录

只需一步,快速开始

发新话题 回复该主题

专问xiyou老师 [复制链接]

1#
请问,信息置顶调用代码多少钱?
分享 转发
TOP
2#

帮忙顶一下
TOP
3#

望答复!
TOP
4#

哪个模板有?
TOP
5#

你可以参考一下这个,里面有信息置顶代码
http://bbs.pageadmin.net/showtopic-35821.aspx
这要你自己去创建数据模型
TOP
6#

<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>
在模型里是不是得写类似以上的代码?
TOP
7#

不一定,主要看你想要做成什么效果
之前回答的链接里有基本的置顶代码
TOP
8#

做成把需要置的信息显示在最顶端,置顶信息文字为红色,并显示置顶字样。
TOP
9#

做成把需要置顶的信息显示在最顶端,置顶信息文字为红色,并显示置顶字样。
TOP
10#

<style>
.zgzp{clear:both;} /*文章带置顶样式*/
.zgzp li .tw{float:left;text-align:left;padding:0px 0px 0px 0px;overflow:hidden} /*置顶通用样式*/
.zgzp .tw .pic{float:right;padding:0px 0px 0px 0px;}
.zgzp .tw .title{text-align:left;line-height:15px;}
.zgzp .tw .title a{float:left;padding-left:2px;font-size:12px;color:red;overflow:hidden;}
.zgzp .tw .date{float:right;padding:0px 0px 0px 0px;color:black}

.zgzp li.normal{clear:both;height:20px;padding:6px 0 2px 2px;text-align:left;overflow:hidden;}
.zgzp .normal .title{float:left;text-align:left;padding:0 0 0 2px;background:url(images/article_arrow.gif) no-repeat left center;}
.zgzp .normal .date{float:right;color:black;padding-right:2px;}


</style>




<div class="zgzp">
<ul>
<%
string pic="/e/images/diy/top.jpg",istop="0";
DataTable dt;
DataRow dr;
dt=Get_Data();
for(int i=0;i<dt.Rows.Count;i++)
{
dr=dt.Rows;
istop=dr["istop"].ToString();
%>
<%if(istop=="1"){%>
<li class="tw">
<%if(pic!=""){%><span class="pic"><a href="<%=Detail_Url(dr)%>" target="<%=Target%>"><img src="<%=pic%>" border="0" > </a>
</span> <%}%><span class="title"><a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>" ><%=SubStr(dr["title"].ToString(),Title_Num,true)%><span class="date"><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%> </span>
</a></span>


</li>
<%}
else
{%>
<li class="normal"><span class="title">
<a href="<%=Detail_Url(dr)%>" target="<%=Target%>" title="<%=Server.HtmlEncode(dr["title"].ToString())%>" style="<%=dr["zg_xb"]%>"><%=SubStr(dr["title"].ToString(),Title_Num,true)%></a></span>
<span class="date"><%=((DateTime)dr["thedate"]).ToString("yyyy-MM-dd")%></span>

</li>
<%
}
}
%>
</ul></div>





如上图,设置置顶后,信息怎么没移到顶部,还在原来的位置,代码哪写的不对?望指点迷津!
TOP
11#

  1. <style>
  2. .hh_article{clear:both;} /*文章带置顶样式*/
  3. .hh_article li.tw{text-align:left;border:1px dotted #cccccc;border-width:0 0 1px 0;padding:5px 0 5px 0;overflow:hidden;} /*置顶通用样式*/
  4. .hh_article .tw .pic{float:left;margin:5px 10px 5px 0;border:1px solid #dddddd;display:inline}
  5. .hh_article .tw .title{text-align:left;line-height:25px;}
  6. .hh_article .tw .title a{font-weight:bold;padding-left:0px;font-size:14px;color: #cc0000}
  7. .hh_article .tw .introduct{padding:2px 5px 5px 0px;line-height:20px;color: #666666;}
  8. .hh_article .tw .pixc{float:right;width:30px;height:30px;border:1px solid #000}
  9. .hh_article li.normal{clear:both;height:40px;line-height:40px;text-align:left;overflow:hidden;}
  10. .hh_article .normal .title{float:left;text-align:left;padding:0 0 0 10px;background:url(images/article_arrow.gif) no-repeat left center;}
  11. .hh_article .normal .date{float:right;color: #666666;padding-right:2px}
  12. </style>




  13. <div class="hh_article">
  14. <ul>
  15. <%
  16. string pic="/e/images/diy/toip.jpg",istop="0";
  17. DataTable dt;
  18. DataRow dr;
  19. dt=Get_Data();
  20. for(int i=0;i<dt.Rows.Count;i++)
  21. {
  22. dr=dt.Rows[i];
  23. pic=dr["titlepic"].ToString();
  24. istop=dr["istop"].ToString();
  25. %>
  26. <%if(istop=="1"){%>
  27. <li class="tw">
  28. <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>
  29. </li>
  30. <%}
  31. else
  32. {%>
  33. <li class="normal"><span class="title">
  34. <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>
  35. <span class="date"><%=((DateTime)dr["thedate"]).ToString("MM-dd")%></span>
  36. <span class="clear"></span>
  37. </li>
  38. <%
  39. }
  40. }
  41. %>
  42. </ul></div>
复制代码
这是我做的,你可以看一下,


TOP
12#



把代码复制过去了,但是显示的结果却是上图,不知道问题出在哪,晕菜了!
TOP
13#

始终没有靠顶端显示呢?
TOP
14#

看你调用的地方
TOP
15#

你在看看你调用的地方是不是错了
TOP
16#



好用了,万分感谢xiyou老师的耐心和不厌其烦的指导,愿您的事业蒸蒸日上!
TOP
发新话题 回复该主题