View-ForumsGroupView.ascx 读解

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

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

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


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

 

View-ForumsGroupView.ascx 读解View-ForumsGroupView.ascx 读解<span class="txt5"></span><%# DataBinder.Eval(Container.DataItem, "Description"%><%# Formatter.FormatSubForum( (Forum) Container.DataItem ) %></span>
View-ForumsGroupView.ascx 读解
<br />
View-ForumsGroupView.ascx 读解
<forums:ForumModerators runat="server" ForumID='<%# ((Forum)Container.DataItem).ForumID %>'/>

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

分析完毕,现在修改起来也简单了,以后研究的时候会继续贴上来的,嘿嘿 版面的简介和版主显示 这三个分别显示:最后帖子,主题数,帖子数的。好了,后面都是一些闭合语句了。分析完毕,现在修改起来也简单了,以后研究的时候会继续贴上来的,嘿嘿
上一篇:解读 Knative v0.13.0版本特性


下一篇:k8s 原生Serverless 实践:ASK 与 Knative