不费吹灰之力,给博客首页添加“最近评论”栏

1、将UI\Controls\RecentComments.ascx和.cs复制到AggSute\;

2、在AggSite\Template.ascx相关位置添加下面两行:
<%@ Register TagPrefix="uc1" TagName="RecentComments" Src="RecentComments.ascx" %>
<uc1:RecentComments id="RecentComments" runat="server"></uc1:RecentComments>

3、把AggSite\RecentComments.ascx中的
namespace Dottext.Web.UI.Controls
改为:
namespace Dottext.Web.AggSite

Inherits="Dottext.Web.UI.RecentComment"
改为:
Inherits="Dottext.Web.AggSite.RecentComments"

4、把AggSite\RecentComments.ascx.cs中

BindList()函数
query.ItemCount=Config.CurrentBlog().ItemCount;
改为:
query.ItemCount=5; //显示评论的数目

OnLoad(EventArgs e)函数注释掉下面语句:
this.Visible=Dottext.Web.UI.Globals.CheckContorVisible("RecentComments");
string url=Config.CurrentBlog().FullyQualifiedUrl;
RSSHyperlink1.NavigateUrl=url+"RecentCommentsRSS.aspx";

5、修改样式,然后重新编译DotText。OK!

原文地址:https://www.cnblogs.com/pack27/p/410064.html