惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
博客园 - 聂微东
The Cloudflare Blog
爱范儿
爱范儿
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
Last Week in AI
Last Week in AI
Jina AI
Jina AI
V
V2EX
罗磊的独立博客
V
Visual Studio Blog
A
About on SuperTechFans
IT之家
IT之家
P
Proofpoint News Feed
B
Blog
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog

博客园 - 阿昆

[分享]真正的分页存储过程,借鉴了CSDN上众多力量,除BUG版,分享给大家 CommunityServer页面间关系 CommunityServer研习心得 CommunityServer皮肤主题的更换 CommunityServer实例分析 Community Server系列之七:快速找到需要修改的文件[技巧] Community Server系列之六:CS2中的关键词及数据结构 Community Server系列之八:CS2中的CSContext Community Server系列之四:Ajax在CS2.0中的应用1 Community Server配置对网址中的www信息处理功能分析 Community Server架构:博客业务详细分析 如何在 Microsoft Visual Studio 2005 中直接Debug Community Server 2.0 的代码 与 Visual Studio 2005 Web Application Projects Community Server2.0专注细节一 邮件提醒按钮实现(上) Community Server专题附录一: 什么是Threads & Processes Community Server专题九:MemberRole之Profile Community Server专题八:MemberRole之Membership深入篇 Community Server专题八:MemberRole之Membership Community Server专题七: Job & Timer Community Server专题六:Delegates & Events
CommunityServer布局 - 阿昆 - 博客园
阿昆 · 2006-06-02 · via 博客园 - 阿昆

如何修改CCS的页面布局 相信很多人觉得比较麻烦
这里就来看看CCS的首页有些什么

1

、加载默认首页布局
<CS:ContentContainer runat="server" id="MPContainer">
文件位置:CommunityServerControls\ContentContainer.cs该类继承于MetaBuilders.WebControls.MasterPages.ContentContainer用来加载MasterPage(主页布局)的实体类
首先会访问当前设定的样式风格的(主页控件) 默认为Matser.ascx
如果不存在~ 则会进一步访问默认风格的主页控件~ 默认风格为Default在具体运行过程中。它首先去加载 ~/Themes/当前用户选择的风格名称/Masters/Master.ascx
如果该文件不存在~ 则会跑去加载~/Themes/Default/Masters/Master.ascx
如果也不在~ 那就啥都不加载~
 
所以当你设定某个风格后
你又不小心把这个风格的文件夹删除了或者这个风格除了文件夹啥都没有
首页依然还会有内容输出~ 正式因为他们默认加载的~/Themes/Default/Masters/Master.ascx
但是由于你当前风格不是Default所以仅能显示页面布局 而不懈怠DefaultCCS样式控制
如果基于默认布局做新皮肤~ 可以新建一种风格的文件夹 然后仅仅添加需要的样式控制和图片就可以了关于<CS:ContentContainer runat="server" id="MPContainer">的内部
 public class Region : MetaBuilders.WebControls.MasterPages.Region{}
 public class Content : MetaBuilders.WebControls.MasterPages.Content{}
 public class Form : MetaBuilders.WebControls.MasterPages.NoBugForm {}
说明了Region  Content  Form  均是继承MetaBuilders公司的MasterPages控件的部分
大家可以去http://www.metabuilders.com/Tools/MasterPages.aspx下载控件来做研究
该控件大致分为4个类
(1)Content: This control contains the content for a particular region
此类控件包含真实内容
(2)ContentContainer: This control serves two distincts purposes: - it marks the location where the Master Page will be inserted into the Page - it contains the various Content sections that will be matched to the Master Page's Region controls (based on their ID's).
此控件有两个意图:
·
作为一个定位标志,标识Master Page将被插入到页中;
·
Region Controls相匹配
(3)NoBugForm: A server form that does not cause a problem by being inside a master page or other naming container.
无错form。可以放心使用
(4)Region: The control marks a place holder for content in a master page
占位控件

2

加载文件和基本设置
3.1
加载js文件
<CS:Script Src = "Utility/UpdatePosts.js" runat = "server" />
文件位于:CommunityServerControls/Script .cs
文件继承于LiteralControl 表示一个html元素
他会通过Src属性来定义js文件 并输出<script src=\"{0}/{1}\" type=\"text/javascript\"></script>这样的js引用html语句
如果Src属性为空 则默认加载Utility/global.js全局js文件默认超链接方式设置
<cs:Base Target="_top" runat="server"/>
转换输出<base target='_top'/>  这样的标签

3

加载自定义的皮肤控件有不少包含了皮肤功能的控件均继承于
SecureTemplatedWebControl
或者TemplatedWebControl.cs两个控件
SecureTemplatedWebControl
继承于TemplatedWebControlTemplatedWebControl又继承于WebControl, INamingContainer
TemplatedWebControl
控件会通过SkinName属性加载当前风格下的皮肤如果不存在则会加载默认布局的皮肤文件
SecureTemplatedWebControl
除了具备TemplatedWebControl的功能外还有检验当前url的功能用来判断当前访问是否一个基于本站的访问
在每个皮肤控件对应的类中我们可以通过重构CreateChildControls方法对该控件进行初始化的设置重构AttachChildControls方法
来对皮肤上的控件对应的变量事件进行设定
比如首页上的<CS:Login SkinName="Skin-LoginSmall.ascx" runat="server" />
会去加载Skin-LoginSmall.ascx的布局
CommunityServerControls\Login.cs里面我们可以看到该控件的代码