为什么我无法覆盖 SharePoint 发布页面中的默认母版页内容?
因此,我使用发布门户模板设置了一个网站集,并删除了包含三层的原型网站结构。在第二层,我创建了一个发布网站,并为该网站及其第三层子网站开发了一个自定义母版页。问题在于,有几页的横幅图形应该修改为不一致。然后,我将两个新的 ContentPlaceHolder 控件添加到 SharePoint Designer 中的母版页,并使用 SharePoint 界面创建新的发布页面。最后,我在 SharePoint Developer 中验证它们是否具有正确的母版页,将我的 asp:content 控件添加到页面并插入特定于页面的横幅图形。唯一的问题是母版页默认内容继续在所有页面实例中呈现。如果我从 SharePoint 设计器中的母版页创建新页面,我会在页面声明中获得与在发布网站中创建的基类不同的基类。发布网站是否会忽略任何非 SharePoint contentPlaceHolders?
So I've setup a site collection using the Publishing Portal template and stubbed out a prototype site structure including three tiers. At the second tier I've created a Publishing site and developed a custom master page for the site and its third tier children. The problem is that the banner graphic on a few pages should be modified to be inconsistent. Then I add two new ContentPlaceHolder controls to my master page in SharePoint Designer and use the SharePoint interface to create my new publishing pages. Finally, I verify in SharePoint Developer that they have the correct master page, add my asp:content controls to the pages and insert the page-specific banner graphic. The only problem is that the master page default content continues to be rendered in all page instances. If I create a new page from the master page in SharePoint designer, I get a different base class in the Page declaration than those created within the Publishing site. Do publishing sites ignore any non-SharePoint contentPlaceHolders?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有什么比 SharePoint ContentPlaceHolders & 更好了。非 SharePoint ContentPlaceHolder。当您将默认内容添加到母版页 ContentPlaceholder 时,如果您不在内容页中覆盖它,那么它将在使用该母版页的所有页面中可见。摆脱它的唯一方法是用内容页面中的空内容覆盖那些内容占位符。由于在所有页面中覆盖 contentPlaceHolder 并不是一个好的方法。我建议不要将内容放在母版页的ContentPlaceHolder中,而是将内容放在页面的内容控制页面中,这样内容就不会出现在所有页面中,而只会出现在需要它的页面中。是的,将完全相同的内容放在多个页面中并不好。但就你而言,这只是选项。可能您尝试将内容包装到用户控件中,以便代码只能更新一处
There is nothing like SharePoint ContentPlaceHolders & non-SharePoint ContentPlaceHolders. When you add a Default content to the Master Page ContentPlaceholder and if you dont override it in the Content Page then it will be visible in all the Pages that use that Master Page. Only way to get rid of it is to Override those Content Place Holder with empty content in the Content Pages. As overriding contentPlaceHolder in all the Pages is not an good Aproach. What I recommend is not to place conent in the ContentPlaceHolder of the Master Page but instead , put the content in the Content Control page of the Pages, so that Content doesn't come in all page but only the page that needs it. Yes it not a good to put the exact same content in multiple page. but in your case that is only the Option. May be you try to wrap the content in to a User Control so that the code can be updated only one place