如果没有 Web 部件区域,内容查询 Web 部件不会显示
我正在为客户构建 Sharepoint WCM 网站。
作为页面布局的一部分,我直接在页面中插入内容查询 Web 部件,而不是在 Web 部件区域中(因此用户无法编辑它)。在我的开发环境中一切正常,但是当我将其部署到生产环境时,Web 部件会显示“没有返回任何项目”。
当我进入功能目录并更改页面布局以包含 Web 部件区域包装器时,它解决了问题,但我真的不希望它有 Web 部件区域。我的开发环境是Windows 2003,但生产站点是Windows 2008。
任何人都可以解释为什么它可能无法工作吗?
ThanksI am building a Sharepoint WCM site for a client.
As part of a page layout I inserted a content query web part directly in the page, not in a web part zone (so the users couldn't edit it). Everything works fine in my development environment however when I deployed it to production the web part would say 'no items returned'.
When I went into the feature directory and changed the page layout to include the webpart zone wrapper it fixed the problem however I don't really want it to have a web part zone. My development environment is Windows 2003 however the production site is Windows 2008.
Can anyone explain why it may not be working?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个简单的想法是,您可以右键单击 SharePoint Designer 中的 WebPart 区域,然后取消选中允许用户操作它的选项。
您将在页面中拥有一个 Web 部件,就像它位于 WP 区域之外一样“锁定”。
编辑
WebPartPages:WebPartZone 标记中的参数:
A quick idea is that you can right-click the WebPart Zone in SharePoint Designer and uncheck the options that allow the users to manipulate it.
You will have a webpart in the page just as 'locked' as if it was outside the WP Zone.
Edit
Parameters in the WebPartPages:WebPartZone tag:
这可能不是您的问题,但请记住,如果您将 CQWP 直接嵌入到 PageLayout 中,它无法访问 SPContext.Current (即 Web 部件不知道它在站点层次结构中的位置) ),因此它将默认返回网站集中的所有内容。 (既然如此,它似乎会返回所有内容,而不是什么也不返回。)如果这确实与您的问题相关,这里有一篇文章解释了解决方法:
http://suguk.org/blogs/sharepointhack/archive/2008/09/17/13785.aspx
This might not be what your issue is, but keep in mind that if you embed the CQWP directly in the PageLayout, it doesn't have access to SPContext.Current (i.e. the web part doesn't know where it is in the site hierarchy), so it will default to returning everything in the Site Collection. (That being the case, it would seem like it would return everything and not nothing.) Here's a post explaining a work-around, if this is indeed related to your issue:
http://suguk.org/blogs/sharepointhack/archive/2008/09/17/13785.aspx