简体   繁体   English

处理动态列数

[英]Handling dynamic number of columns

I'm developing a CMS of sorts, and I want to give my users the possibility of customizing the display. 我正在开发各种CMS,我希望为用户提供自定义显示的可能性。 More precisely, I want to give them the ability to choose to display or hide the left column, the right column and/or the top div. 更准确地说,我想让他们能够选择显示或隐藏左列,右列和/或顶部div。 The middle column cannot be hidden since this is where the actual content will show, whereas the other columns are for navigation or side menus. 中间的列不能隐藏,因为这是实际内容的显示位置,而其他列则用于导航或侧边菜单。

I've been looking for a way to make this as smart and flexible as possible. 我一直在寻找一种使之尽可能智能和灵活的方法。 For now I'm using a MasterPage, but that seems to be too constraining. 现在,我正在使用MasterPage,但这似乎太过局限了。 For instance, with MasterPage you need to add a ContentPlaceHolder control in every of your ASPX pages. 例如,使用MasterPage,您需要在每个ASPX页面中添加一个ContentPlaceHolder控件。

What are the best practices in this area? 这方面的最佳做法是什么? I guess a simpler way of saying this would be "I want to create a template system over which I have complete control". 我猜这是一种更简单的说法:“我想创建一个可以完全控制的模板系统”。

I would strongly suggest looking into existing platforms that will give your uses far more flexibility and control then you could code from scratch. 我强烈建议您研究现有平台,这些平台将给您带来更多的灵活性和控制力,使您可以从头开始编写代码。 Try looking at DotNetNuke which is open source. 尝试看一下开源的DotNetNuke。

If you do roll your own cms type system, Master Pages is a good place to start. 如果您使用自己的cms类型系统,则母版页是一个不错的起点。

From what you describe a master page with 5 content spots 根据您对包含5个内容点的母版页的描述

  • header 标头
  • Left column 左栏
  • Content column 内容栏
  • right column 右栏
  • footer 页脚

In your master page you can have default content for all but Content column. 在母版页中,除“内容”列外,所有内容都可以具有默认内容。

Then you can include in your master page a user control or custom control which produces content based on your CMS data. 然后,您可以在母版页中包含一个基于CMS数据生成内容的用户控件或自定义控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM