View-ForumsGroupView.ascx 读解

为了修改首页的框架,一路跟踪到了View-ForumsGroupView.ascx这个文件,其实他就是一个页面的模版,微软在这里并没有弄了太多花絮,所以阅读起来很方便。
None.gif<%@ Control Language="C#" %>
None.gif
<%@ Register TagPrefix="Forums" Namespace="AspNetForums.Controls" Assembly="AspNetForums.Controls" %>
None.gif
<%@ Import Namespace="AspNetForums" %>
None.gif
<%@ Import Namespace="AspNetForums.Controls" %>
None.gif
<%@ Import Namespace="AspNetForums.Components" %>
导入了一些名称空间,并且声明了一个控件。
None.gif<Forums:Ads Zone="Inline" runat="server" />
注释上显示是广告,我个人理解为登入框上面的banner。13.gif

ExpandedBlockStart.gifContractedBlock.gif<%    if ( Users.GetUser().IsAnonymous ) dot.gif%>
InBlock.gif
<table width="100%" cellspacing="0" cellpadding="5" border="0">
InBlock.gif    
<tr>
InBlock.gif        
<td>
InBlock.gif            
<!-- ForumGroupView.Header.End -->
InBlock.gif            
<Forums:Login SkinFilename="Skin-LoginSmall.ascx" runat="server" ID="Login1" />
InBlock.gif            
<!-- ForumGroupView.MainCentent.Start -->
InBlock.gif        
</td>
InBlock.gif    
</tr>
InBlock.gif
</table>
ExpandedBlockEnd.gif
<%    }
    %>
匿名用户显示的表格,感觉和动网的有些类似。
None.gif<table width="100%" cellpadding="5" cellspacing="0">
None.gif    
<tr>
None.gif        
<td valign="bottom" colspan="2">
None.gif            
<table width="100%" cellpadding="0" cellspacing="0">
None.gif                
<tr>
None.gif                    
<td class="txt4" align="left" nowrap>
None.gif                        
<Forums:DisplayUserWelcome runat="server" />
None.gif                    
</td>
None.gif                    
<td class="txt4" align="right" valign="bottom" nowrap>
ExpandedBlockStart.gifContractedBlock.gif                        
<%    if ( !Users.GetUser().IsAnonymous ) dot.gif%>
InBlock.gif                        
<class="lnk3" href="<%=Globals.GetSiteUrls().MyFavorites%>">
InBlock.gif                            
<%=ResourceManager.GetString("MyFavorites_Description")%>
InBlock.gif                        
</a>
InBlock.gif                        
<br />
InBlock.gif                        
<!--<Forums:MarkAllRead runat="server" ID="Markallread1"/>-->
ExpandedBlockEnd.gif                        
<% }
 %>
None.gif                        
<Forums:ForumAnchor class="lnk3" AnchorType="PostsActive" runat="server" /><br />
None.gif                        
<Forums:ForumAnchor class="lnk3" AnchorType="PostsUnanswered" runat="server" /><br />
None.gif                    
</td>
None.gif                
</tr>
None.gif                
<tr>
None.gif                    
<td align="left">
None.gif                        
<Forums:BreadCrumb ShowHome="true" runat="server" ID="Breadcrumb1" />
None.gif                    
</td>
None.gif                    
<td align="right" class="txt4">
None.gif                        
<Forums:SearchRedirect ID="SearchRedirect" runat="server" />
None.gif                    
</td>
None.gif                
</tr>
None.gif            
</table>
None.gif        
</td>
None.gif    
</tr>
None.gif
</table>

这个就是登入以后所显示的表格。
下面就是论坛组的显示了,我们公司就是要我修改这里,所以准备一点一点分析。
None.gif<asp:Repeater EnableViewState="false" runat="server" id="forumGroupRepeater">
定义了一个Repeater控件,用来显示整个论坛组框架。
None.gif<HeaderTemplate>
None.gif                    
<!-- ********* Repeater.Header.Start ************* //-->
None.gif
                    <table width="100%" class="tableBorder" cellpadding="4" cellspacing="1">
None.gif                        
<tr>
None.gif                            
<td colspan="2" class="column" align="center" width="*"><% = ResourceManager.GetString("ForumGroupView_Inline1"%></td>
None.gif                            
<td class="column" align="center" width="177" nowrap><%= ResourceManager.GetString("ForumGroupView_Inline4"%></td>
None.gif                            
<td class="column" align="center" width="65" nowrap><%= ResourceManager.GetString("ForumGroupView_Inline2"%></td>
None.gif                            
<td class="column" align="center" width="65" nowrap><%= ResourceManager.GetString("ForumGroupView_Inline3"%></td>
None.gif                        
</tr>
None.gif                    
</table>
None.gif                    
<!-- ********* Repeater.HeaderTemplate.End ************* //-->
None.gif
                </HeaderTemplate>
定义了头模板,ResourceManager.GetString(),让我看了很长时间,个人以为是整理了一下字符串,然后又从配置里面把数据读出,从Language目录里的Resources.xml读出数据。
<td class="fh1" colspan="5" valign="bottom">
None.gif   
<asp:ImageButton ID="ExpandCollapse" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ForumGroupID") %>' ImageUrl='<%# Formatter.ExplandCollapseIcon( (ForumGroup) Container.DataItem ) %>' ToolTip='<%# ResourceManager.GetString("ForumGroupView_ExpandCollapse")%>' Runat="server"/> &nbsp;<a href="<%# Globals.GetSiteUrls().ForumGroup ( (int) DataBinder.Eval(Container.DataItem, "ForumGroupID")) %>"><%# DataBinder.Eval(Container.DataItem, "Name"%></a>
 </td>
这个表格显示了一个图片和论坛组的名字。
None.gif<Forums:ForumRepeater ForumGroupID='<%# DataBinder.Eval(Container.DataItem, "ForumGroupID") %>' HideForums='<%# DataBinder.Eval(Container.DataItem, "HideForums") %>' runat="server">
这是一个自定义的Repeater控件,具体代码还没研究过。
None.gif<td class="f1" width="20">
ExpandedBlockStart.gifContractedBlock.gif
<%dot.gif# Formatter.StatusIcon( (Forum)Container.DataItem ) %>
None.gif
</td>
这个是显示版面是否有信息的那个图片。
None.gif<Forums:ForumLogo runat="server" Forum='<%# (Forum) Container.DataItem %>' />
这个是版面的logo,如果有就显示,没有就不显示,都在ForumsRepeater控件里都有了。
None.gif<b><href="<%# Globals.GetSiteUrls().Forum( ((Forum) Container.DataItem).ForumID ) %>">
ExpandedBlockStart.gifContractedBlock.gif                                                    
<%dot.gif# DataBinder.Eval(Container.DataItem, "Name"%>
None.gif                                                
</a></b>
ExpandedBlockStart.gifContractedBlock.gif                                            
<%dot.gif# Formatter.FormatUsersViewingForum( (Forum) Container.DataItem ) %>
None.gif                                            
<br />


这个很容易理解,就是版面名字的显示,<%# Formatter.FormatUsersViewingForum( (Forum) Container.DataItem ) %>
是显示版面现在的在线人数,很多余的东西,缓存太久了,根本不能及时显示。

 

ExpandedBlockStart.gifContractedBlock.gif<span class="txt5"></span><%# DataBinder.Eval(Container.DataItem, "Description"%><%# Formatter.FormatSubForum( (Forum) Container.DataItem ) %></span>
None.gif
<br />
None.gif
<forums:ForumModerators runat="server" ForumID='<%# ((Forum)Container.DataItem).ForumID %>'/>

版面的简介和版主显示
None.gif<td class="fh3" align="center" width="175">
ExpandedBlockStart.gifContractedBlock.gif    
<%# Formatter.FormatLastPost( (Forum) Container.DataItem, (bool) true ) %>
None.gif
</td>
None.gif
<td class="fh3" align="center" width="64">
ExpandedBlockStart.gifContractedBlock.gif    
<%# Formatter.FormatNumber( ((Forum) Container.DataItem).TotalThreads ) %>
None.gif
</td>
None.gif
<td class="fh3" align="center" width="65">
ExpandedBlockStart.gifContractedBlock.gif    
<%# Formatter.FormatNumber( ((Forum) Container.DataItem).TotalPosts ) %>
None.gif
</td>
这三个分别显示:最后帖子,主题数,帖子数的。
好了,后面都是一些闭合语句了。

分析完毕,现在修改起来也简单了,以后研究的时候会继续贴上来的,嘿嘿 版面的简介和版主显示 这三个分别显示:最后帖子,主题数,帖子数的。好了,后面都是一些闭合语句了。分析完毕,现在修改起来也简单了,以后研究的时候会继续贴上来的,嘿嘿
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值