如何为设计人员提供 ASP .NET 母版页的轻松编辑?
设想: 我的所有页面都有一个非常标准的母版页。 它包括常用的登录表单和要在每个页面上提取的其他动态列表。 网页设计师已经可以修改每个页面的中心内容占位符。 但是,母版页的设计和布局仍然在我的项目中,对设计的任何修改都必须在 Visual Studio 中进行,并且项目需要重新编译和重新部署。
通过 CMS 提供几乎完全访问设计母版页的最佳方式是什么? 我可以识别的一些问题是包含任何动态列表或特定控件(例如登录表单)。
谢谢。
Scenario:
I have a pretty standard master page for all my pages. It includes the usual login forms and other dynamic lists to be extracted on each page. Webdesigners can already modify the central content place holder of each page. But still, the design and layout for the master page is still in my project and any modification to the design must be made in Visual Studio and the project re-compiled and re-deployed.
What is the best way to provide near-full access to designing the master page through a CMS? Some of the problems I can identify is the inclusion of any dynamic lists or specific controls such as a login form.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
除非您想在门户中托管您的内容,否则我不知道对此的完美答案。
如果他们设计的位只是页面的外观和感觉,那么这可以通过 css 控制,您可以允许他们使用不同的 css 文件创建主题。
Unless you want to host your content within a portal I don't know of a perfect answer to this.
If the bits they design just amount to look and feel for the page then this can be controlled by css and you could allow them to create themes using different css files.
这确实是一个有趣的问题,并且没有完美的解决方案。 我在一家电子商务商店工作时遇到了这个问题,坦率地说,在很多情况下我只是要求设计师为我提供 html 和 css,然后我会抓取 html 片段和 css 并将它们添加到我的项目中。 是的,这很乏味……
然后我们构建了一个 cms,设计者可以将他们的 html 复制并粘贴到 html 编辑器中,然后我们将这些 html 片段存储在数据库中。 我的网络应用程序会在运行时从数据库中获取这些内容。 这解决了一些问题,但不是全部,因为它并没有让他们完全控制网页的设计。
最重要的是,您需要对设计师如何向您提交作品制定标准。 如果你有这个,并且你可以依赖 html 和 css,那么你就可以考虑围绕它构建一个 CMS。 在 RAD 的今天,我发现使用交付给我的 html 和 css 更容易,只需根据需要将这些片段复制并粘贴到我的母版页和其他页面中即可。
This is indeed an interesting question, and there is no perfect solution. I worked for an ecommerce shop with this issue, and frankly, I just asked the designers in many cases to provide me there html and css, then I would grab the html pieces and css and add them to my project. Yes this was tedious....
Then we we built a cms where the designers could copy and paste their html into html editors, and we would store those pieces of html in a database. My web app would grab those from the database at run time. This solve some issues, but not all, since it did not give them complete control of the design of the web page.
The bottom line is you need to standard as to how the designer will submit their work to you. If you have that, and you can count on the html and css, then you can star to think of possibly building a CMS around that. In this days of RAD, I have found it easier to just work with the html and css delivered to me and simply copy and paste the pieces into my master page and other pages as needed.
虽然这不是 CMS 答案,但您确实可以允许设计人员在 Expression Web 中打开母版页。 我不会说它是世界上最伟大的工具,但我已经让设计师在 Expression 中完成了母版页设计,并取得了良好的效果。
然而,有一个痛点。 如果打开整个项目,设计者将看到文件背后的代码作为单独的项目,而不是像 Visual Studio 中看到的树视图。
我想您可以通过 CMS 检查母版页以便与 Expression 一起使用,但没有内置方法可以执行此操作,我也不知道有第三方工具可以执行此操作。 希望 Expression Web 3 能让事情变得更容易。
While this is not a CMS answer, you do have the ability to allow designers to open the master pages in Expression Web. I will not say it is the greatest tool in the world, but I have had designers work up the master page designs in Expression with good results.
There is a pain point, however. If the entire project is opened, the designer will see the code behind files as separate items, not like the treeview view seen in Visual Studio.
I imagine you could have the master page checked out for use with Expression through a CMS, but there is no built in way to do this, nor do I know of a third party tool to do this. Hopefully Expression Web 3 will make things easier.
如果您有 CMS,则最好让它完全控制页面内容。 如果 CMS 无法执行某些操作,您可以考虑为 CMS 编写扩展或插件模块,然后设计人员可以将其拖放到 CMS 页面编辑器中的页面上。
如果您的 CMS 不支持插件模块,您可能会尝试强制 CMS 和母版页执行它们不打算执行的操作。
如果上述方法不适用于您的情况,还有另一种想法:将内联框架放置在托管在 CMS 中编辑的页面的母版页上。
希望有帮助。
If you have a CMS, you may be better to give it full control over page content. If there are things the CMS cannot do, you could look to write extensions or plugin modules for the CMS that your designers can then drop onto the page in the CMS's page editor.
If your CMS doesn't support plugin modules, you may be trying to force both the CMS and master pages to do things they were not intended to do.
If the above doesn't work in your situation, here's another thought: place inline frames on your master page that host pages that are edited in the CMS.
Hope that helps.
您是否可以在母版页中放置占位符来代替设计师应允许编辑的区域? 由于母版页只能在 Visual Studio 中编辑,因此它可能是您目前唯一可行的选择。 这种方法的一个问题是,放置在占位符中的内容不太可能有效,因为您可能会将标签在一个占位符中保持打开状态,而在另一个占位符中关闭。
我知道它很难看,但它可能会为您提供所需的控制(只要您不介意 XHTML 验证器一直警告您)。 您在占位符中放置的内容可以是用户控件或文字内容或其他内容,但您必须动态加载它。
想法?
编辑:这行不通。 PlaceHolder 将呈现
标签,这会使事情变得混乱。 也许您可以扩展 PlaceHolder 并覆盖它呈现 HTML 的方式。
Would it be possible for you to put placeholders in the Master Page in place of the areas that designers should be allowed to edit? Since Master Pages are only editable in Visual Studio, it may be your only feasible option at this point in time. One problem with this approach is that the content put in the placeholders is unlikely to be valid, since you would probably have tags left open in one placeholder and closed in another.
I know it's ugly, but it might give you the control you need (as long as you don't mind the XHTML validator warning you all the time). What you put in the placeholders could be your user controls or literal content or whatever, but you'd have to load it dynamically.
Thoughts?
EDIT: This won't work. The PlaceHolder is going to render
<div>
tags that would mess things up. Maybe you could extend PlaceHolder and override how it renders its HTML.有趣的问题,
我自己不久前也涉足过这个领域。
当不涉足 Photoshop 或 Flash 领域时,这些网页设计师的知识有多少?
如果使用 DIY-CMS,也许您可以对最容易受影响的对象进行模板化,例如制作一个通用的(如您喜欢的任何内容,而不是他们喜欢的任何内容;-))列表和输入设计的方式(如果适用)。
只要您建立了一个完整的框架,通过 CMS 处理设计人员可用的属性,就不需要重新编译......但是,当然,我可以轻松地看到开发人员(阅读:我) 绊倒
进入本质-完美-完美的差距......
恐怕最简单、唯一可管理的路径是标准化设计师向你表达他们的需求和想要的方式......它只是不会自行编码...... ?
您能提供一些例子吗
Interesting question,
been dabbling in that area myself a while ago.
How knowledgeable are these web designers when not in the realm of not-inside-Photoshop-or-flash?
If using a DIY-CMS, perhaps you can template the most susceptible objects, e. g. making a generic (as in whatever you feel like, not whatever they feel like ;-)) list and a way of entering design, if applicable.
As long as you have a thorough framework set up, that deals with the attributes available to the designers through the CMS, there shouldn't be any need for recompiling... but of course, I can easily see a developer (read : me) stumbling
into the gap of nitty-pitty-perfection....
I'm afraid the easiest, and only manageable, path is to standardize how the designers express their needs&wants to you...it just won't code itself...
Could you provide some examples?
好吧,对于 Web 应用程序项目 页面,直到已访问(链接为 2005 年,但仍然适用)。 这意味着实际的 .aspx(和 .ascx 等)页面以其原始状态部署。 设计者可以更新服务器上页面的格式,并且下次有人请求该内容时将编译更新。
允许设计人员下载当前页面并通过网站的 UI 上传替换页面相对简单。 但是,它不是很安全(并且可能永远不应该这样做)。 最好允许设计人员通过网络访问虚拟目录,以便他们可以使用 表达式 Web。 通过这种方式,设计师可以打开当前网站,编辑页面,并将结果直接投入生产(尽管这个想法可能很可怕)。
由于我因拥有正确答案而被否决,让我指出一些事情。
网站项目按需编译代码隐藏和页面。 如果您需要定期更新代码,这是一个不错的解决方案。
Web 应用程序项目可以配置为可更新。 所有代码隐藏和类都编译成程序集,所有 aspx、ascx 等页面都根据需要部署和编译。 这意味着设计人员可以连接到网站,更新布局和静态内容,并在下一个请求时查看更改。
这是我首选的部署方法。 我有一些野外的 Web 应用程序项目,可更新的 aspx 文件与我的 dll 一起部署。 这个想法是网站的用户可以更改用户界面,而无需向我提交更新,这样我就可以为他们重新编译它。
Well, with a Web Application Project pages are not compiled until accessed (link is 2005 but it still applies). This means that the actual .aspx (and .ascx etc) page is deployed in its original state. A designer can update the format of the page on the server and the updates will be compiled the next time someone requests that content.
It would be relatively trivial to allow designers to download the current pages and upload replacements through your website's UI. However, it isn't very secure (and probably should never be done). It would be better to allow designers access to the virtual directory over the web so they can connect to it using a tool such as Expression Web. This way the designer can open the current website, edit pages, and push the results directly into production (scary tho that thought may be).
As I'm getting downvoted for having a correct answer, let me point out something.
Website projects compile codebehind and pages on demand. If you need to update code regularly, its an okay solution.
Web application projects can be configured to be updatable. All codebehind and classes are compiled into an assembly, and all aspx, ascx, etc pages are deployed and compiled on demand. This means that a designer can connect to the website, update the layout and static content, and see the changes on the next request.
This is my preferred method of deployment. I have a few web application projects out there in the wild, with updatable aspx files deployed alongside my dll. The idea being that users of the website can alter the UI without having to submit updates to me so I can recompile it for them.
.master 只是一个文本文件。 他们可以随心所欲地编辑它。 当然,他们不会做任何需要您重新编译代码才能查看的事情。 这首先是母版页的巨大胜利:设计师和其他非程序员可以手动编辑它们,而不会破坏任何内容。
让他们访问源代码控制下的文件并让他们发疯。
a .master is just a text file. They can edit it however they like. There's certainly nothing they'd do to it that would require you to recompile the code just to view it. That's the big win with Master Pages in the first place: designers and other non-programmers can edit them manually without breaking anything.
Give them access to the file under source control and let them go nuts.