设计一个用户可以创建主题的网站? (ASP.NET/C#)

发布于 2024-07-17 12:54:39 字数 136 浏览 6 评论 0原文

什么是构建 ASP.NET 网站的优雅方法,让最终用户可以通过用户界面为其网站创建自定义主题?

ASP.NET 主题对我有帮助吗? UI 是否应该允许用户将引导 CSS 文件写入光盘并应用这些文件? 欢迎任何建议。 先感谢您。

What is an elegant way to architecture an ASP.NET website in which end-users can create custom themes for their sites through a user interface?

Would ASP.NET themes help me here? Should the UI allow users to write guided CSS files to disc and apply those? Any suggestions are welcome. Thank you in advance.

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

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

发布评论

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

评论(3

丑丑阿 2024-07-24 12:54:39

我会选择纯 CSS 解决方案,用户可以指定自己的 CSS,并且只能修改主题和布局外观。

你还需要小心不要使用表格,因为它们是刚性的,CSS 可能会碰壁。

另请查看 CSSZenGarden 以了解如何支持用户主题。

I would go with a CSS-only solution where users can specify their own CSS and only that to modify the theme and layout appearance.

You also need to be careful not to use tables as they are rigid and CSS can hit a wall with them.

Also have a look at CSSZenGarden to see how support user theming.

雨后彩虹 2024-07-24 12:54:39

首先,使用强大的语义方法构建干净的 html 模板,定义一个默认的 css 基础,无论选择什么主题(基本元素位置、基本图像、字体定义等),它都能很好地工作,并在单独的文件

现在有两种方法:

让他们配置某些元素的外观并将其首选项存储在数据库中

http:// /acko.net/dev/farbtastic 是一个不错的小部件,用于选择元素的颜色
如果你想更进一步,f.ex。 拖放布局上的元素位置,使用 f.ex http://jqueryui.com/ (或 scriptcalious 或其他一些)并通过 drop 上的 httprequest 将它们的位置保存到数据库

让他们编写他们的 css 文件

如果您喜欢用户编写 css 文件的方法,我会考虑让他们仅覆盖特定类别的元素,但我不'不知道您真正想要实现什么以及您想在主题上走多远,请提供更多详细信息。 我不明白他们为什么要将 CSS 上传到磁盘上,只需将它们放在文本区域中并保存到数据库中即可。

无论您选择哪种方式,您都应该在 http://tumblr.comhttp://storytlr.com 了解有关该主题的想法。

First, build clean html templates with a strong approach on semantics, define a default css base which works well regardless of the theme chosen (basic element positions, basic images, font definitions, etc, etc.), and define your default theme in a separate file

Now there are two approaches:

Let them configure the look of some elements and store their preferences in the DB

http://acko.net/dev/farbtastic is a nice widget for choosing colors of elements
If you want to go further, f.ex. drag&drop element positions on the layout, use f.ex http://jqueryui.com/ (or scriptcaluous or some other) and save their positions to db via httprequest on drop

Let them write their css file

If you'd like the approach of user writing a css file, I'd consider letting them override only specific classes of elements, but I don't know what you really want to achieve and how far you want to go with the theming, provide more details. I don't see why would they upload the css onto disk, simply put them in a textarea and save to the database.

Regardles of the way you choose, you should check how it works on http://tumblr.com or http://storytlr.com to get an idea on the subject.

泪冰清 2024-07-24 12:54:39

男人,
ASP.Net 主题对于小型网站来说很好,但对于大型网站来说,那就太糟糕了,你无法控制你的 CSS 包含和许多其他东西,在我的工作中,我仅使用主题来定义控件的属性,例如将文本框的 CSSClass 设置为“ Tb”,这真的很棒,因为它将适用于所有文本框,并且您可以节省大量时间,我就到此为止,不会在主题中定义任何 CSS 文件。

然后按照 JZ 的建议创建一个干净的模板,可以很好地更改,例如颜色、字体大小等......
然后创建多个css文件来反映您的模板,然后在母版页中放置一个下拉框并填充模板名称,然后使用jquery或添加动态链接,其中它的值将根据下拉框选择的值而变化。

希望这可以帮助。

man,
ASP.Net themes are fine for small site, but for big sites, it is hell, you cant control your CSS includes and many other things, in my work i use themes only to define properties of controls, like setting CSSClass for textbox to "Tb", this is really great as it will apply to all textboxes, and you save your self a lot of time, and i stop there and wont define any CSS files in the themes.

then as JZ advised create a clean template that can be changed nicely like colors,font size, etc...
and then create multiple css file to reflect your templates, then put a drop down box in your master page and fill it with templates names, then use jquery or add dynamic link, where it's value will change based on the drop down box selected value.

hope this helps.

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