创建“网站构建器” - 我将如何构建它?

发布于 2024-09-06 15:18:15 字数 1436 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一抹微笑 2024-09-13 15:18:15

这很大程度上取决于您的要求。

一个简单的解决方案是使用几个带有占位符的基本模板,稍后填充内容/其他模板。

即模板可能如下所示:

<html>
  <head><title>foo</title></head>
  <body>
    <div id="menu">{auto_generated_menu}</div>
    <h1>{page_header}</h1>
    <div id="content">
      {page_content}
    </div>
  </body>
</html>

然后,您为用户提供一种简单的方法来定义页面标题和 page_contents,即第一个可能只是一个文本框,内容是使用 TinyMCE 之类的东西填充的。
如有必要,客户端可以在内容中使用其他占位符,但这可能不是必需的。

之后,您只需添加一个自动生成的菜单,创建用用户输入的内容替换占位符的逻辑(类似于 template.Content = template.Content.Replace("{page_content}", customer .Pages['foo'].GetTemplateContent("page_content")); )并可能添加带有客户提供的颜色和字体设置的 CSS 样式表。

最复杂的部分是后端和用户身份验证。

该解决方案实施起来很简单,根本没有真正的灵活性,但它允许客户快速编写一些文本并添加一些精美的图像,而无需关心其他任何事情。

要保留颜色设置,请将它们写入数据库并在每次更改时创建新的 CSS 样式表。对于其他内容,只需使用数据库表“内容”以及“键”和“值”列,您可能希望在每次更改时生成静态 HTML 页面。

It depends a lot on your requirements.

A simple solution would be to have several base-templates with placeholders that get filled with content/other templates later.

I.e. a template might look like this:

<html>
  <head><title>foo</title></head>
  <body>
    <div id="menu">{auto_generated_menu}</div>
    <h1>{page_header}</h1>
    <div id="content">
      {page_content}
    </div>
  </body>
</html>

Then you provide the users with a simple way to define page headers and page_contents, i.e. the first might just be a textbox, the content is filled by using something like TinyMCE.
If necessary, the clients can use other placeholders in the content, but that might not be neccessary.

After that you just add an auto-generated menu, create the logic that replaces the placeholders with the user-entered content (something along the lines of template.Content = template.Content.Replace("{page_content}", customer.Pages['foo'].GetTemplateContent("page_content")); )and maybe add a CSS stylesheet with color and font settings provided by the customers.

The most complex part is the backend and user-authentification.

This solution is simple to implement and has no real flexibility at all but it allows customers to quickly write a few texts and add some fancy images without having to care about anything else.

To persist color settings, write them into the database and create a new CSS stylesheet everytime they are changed. For other content just use a Database table "content" with the columns "key" and "value" and you might want to generate static HTML pages on every change.

樱娆 2024-09-13 15:18:15

您实际上已经接受了编写完整的内容管理系统的任务。这是一项艰巨的任务,根据经验(这基于市场上其他 CMS 的开发时间),单独的开发人员可能需要 6 到 24 个月的时间来构建。例如,Umbraco(一个开源 ASP.NET CMS)的开发人员正忙于将他们的 CMS 移植到 ASP.NET MVC,工作从今年年初开始,预计要到明年年中才能构建,他们他们是业内最有才华的开发人员之一。

我并不怀疑你的才能,但除非你的老板给了你很大的工作时间,或者你计划让你的网站构建器变得非常基本,功能最少,否则构建一个完整的网站构建器或 CMS 可能会很困难超出你的咀嚼能力。

正如其他发帖者所建议的,如果您是 .NET 开发人员,您也许应该尝试市场上现有的 CMS,例如 Umbraco

如果您确实坚持要建立自己的,则需要进行一些认真的规划。看看软件架构设计模式,如 DDD(领域驱动设计),SOLID 原则,如依赖注入、存储库模式、持久性无知、服务层等。MVC 绝对是正确的选择。另请参阅 Martins Fowler 的书 企业应用程序架构模式 或 Dino Esposito 的 Microsoft .NET:为企业构建应用程序或 Eric Evans 领域驱动设计:解决软件核心的复杂性

You've effectively been given the task of writing a full blown Content Management System. This is a mammoth task that would probably take a lone developer anything from 6 - 24 months to build depending on experience (this based on development time of other CMS' on the market). For instance, the developers of Umbraco (an Open source ASP.NET CMS) are busy porting their CMS over to ASP.NET MVC, work started around beginning of this year and is not expected to be built until middle of next year, and they're some of the most talented devs in the industry.

I'm not doubting your talents, but unless your boss has given you a very large time scale to work to, or you plan on your website builder being extreme basic with minimal features, perhaps building a full blown Website builder or CMS is biting off more than you can chew.

As other posters have recommended, you should perhaps try existing CMS on the market such as Umbraco if you're a .NET developer.

If you do insist on building your own, it will need some serious planning. Look at software architectural design patterns such as DDD (Domain Driven Design), SOLID principles such as Dependency Injection, the Repository Pattern, Persistance Ignorance, Service Layers etc etc. MVC is definitely the right way to go. Also check out Martins Fowler's book Patterns of Enterprise Application Architecture or Dino Esposito's Microsoft .NET: Architecting Applications for the Enterprise or Eric Evans Domain-Driven Design: Tackling Complexity in the Heart of Software

卷耳 2024-09-13 15:18:15

如果您想使用 .NET,我建议您看看 Umbraco,这是一个非常流行的开源 CMS,背后有一个非常好的社区。目前它是用 Webforms 编写的,但下一版本 (5) 正在 ASP.NET MVC 中重做。

它还可以在 Microsoft 的 Web 应用程序库 上找到,因此安装起来非常简单。

If you want to go with .NET i'd recommend taking a look at Umbraco, which is a pretty popular open source CMS with a very good community behind it. It's written in Webforms at the moment, but the next version (5) is being redone in ASP.NET MVC.

It's also avaialable on Microsoft's Web App Gallery so it's a breeze to install.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文