要让 Episerver 保留 ID 属性需要做多少工作?
有没有办法让 Episerver 单独保留 HTML id 属性,更重要的是,这需要多少工作?
我知道你也可以删除视图状态,这需要多少工作量?
我不是来讨论语义和优化的,CMS 是否应该接触前端代码是一个长期的争论。我只需要知道这些适应有多困难。
Is there a way to make Episerver leave the HTML id attribute alone and more importantly how much work is that?
I know you could also remove the viewstate, how much work is that?
I'm not here to start a discussion about semantics and optimization, whether or not a CMS should touch the front-end code is a long debate. I just need to know how difficult these adaptions are.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
EPiServer Web 控件是为与 ASP.NET WebForms 框架配合使用而开发的,在某些情况下您对 ID 标签的生成的控制有限。最好使用 EPiServer CMS 6 支持的 dotnet 4.0。
完全消除 WebForms Controls 生成的所有不良 html 需要大量工作。您最终将重写所有内容并失去许多 ASP.NET 内置功能。如果您使用 WebForms,最好是务实且更具成本效益,并接受 ID 标签和小视图状态。
摆脱视图状态的常见方法是删除 ASP.NET 使用的全局表单标记。一个已知的副作用是编辑器使用的视图模式下的右键菜单停止工作,并且一些常见的第三方模块也将停止按预期工作,因为它们使用 form-tag 注入 javascript。您还会遇到 XForms 问题。
如果您希望更好地控制生成的 html,请使用您自己的扩展方法(从 EPiServer 属性中提取值)以 MVC 方式渲染页面。
EPiServer CMS 6 尚不支持 MVC,但将在未来版本中很好地集成。
EPiServer Web Controls are developed to work with the ASP.NET WebForms framework and you have limited control over generation of ID-tags in some cases. It is better if you use dotnet 4.0 which is supported in EPiServer CMS 6.
It is a lot of work to eliminate all bad html generated by WebForms Controls completly. You will end up rewriting everything and loose a lot of ASP.NET built-in functionality. If you use WebForms it is probably better to be pragmatic and more cost effective and accept ID-tags and a small view state.
A common approach to get rid of view state is to remove the global form-tag used by ASP.NET. A known side effect is that the right-click menu in view mode used by editors stops working and also some common third party modules will also stop working as expected since they use the form-tag to inject javascript. You will also get issues with XForms.
If you want better control of the generated html render your page the MVC way using your own extension method that extracts values from EPiServer properties.
MVC is not yet supported by EPiServer CMS 6 but will nicely integrated in a future release.
我猜你只是在谈论模板?
困难的部分是重写表单设计器中对 XForms 的表单支持。
您还需要删除页面编辑功能。
您可能还想重写最常用的控件中的一些内容,例如 EPiServer:Property,但除此之外,它只是不将任何服务器表单放入模板代码中,并且您不会遇到 ASP.NET 垃圾标记的任何问题。
I guess you are only talking about the templates?
The hard part is rewriting the forms support for XForms made in the form designer.
You also need to drop the edit-on-page functionality.
You might also want to override some things in the most used controls such as EPiServer:Property but other than that it's just to NOT put any server forms in the template code and you won't have any problems with ASP.NET garbage markup.