Sitecore 中未发布/受限的项目显示标准值

发布于 2024-08-22 05:32:50 字数 519 浏览 2 评论 0原文

是否可以在用户控件/xslt 渲染中检查某个项目的发布是否受到限制或在 Sitecore CMS 中是否不可发布? 在某些情况下,我们会向 CMS 用户解释如何设置发布限制,并回复有关网站上显示标准值的项目的问题。例如:

  • 我有一个项目,它包含带有信息的字段。
  • 我发布了这个项目,一切都很好。内容正在网站上显示。
  • 我更改了发布限制,并规定它只能在 2010 年 2 月 23 日至 2010 年 2 月 25 日期间发布。
  • 现在发生的情况是,当我再次发布网站时,之前正确显示的项目现在显示标准值。

编辑:

  • 我正在谈论的项目只有 一个版本。 (荷兰语 - 版本 1) 项目只是通过插入制成的 模板并填充信息。 填完信息后, 设置了发布限制。 当完成此操作并且该项目不存在时 属于该日期之内 限制我看到标准值@ 正面。

发布限制可用于确保信息仅在某个时间段内显示,对吗? 我们可以在代码中修复这个问题吗?我们可以检查某个项目是否不在公共限制/未发布的范围内吗?

Is it in usercontrols / xslt renderings possible to check wheter an item has it's publishing restricted or is not publishable in the Sitecore CMS?
We get some situations where we explain users of the CMS how to set publishing restrictions and get back questions about items showing standard values on the website. For example:

  • I have an item and it contains fields with information.
  • I publish this item and everthing is fine. Content is being shown on the website.
  • I change publishing restrictions and say it can only be published from 23-02-2010 to 25-02-2010.
  • What happens now is that when i publish the website again, the item that was shown correctly before now shows Standard Values.

EDIT:

  • The item i am talking about has only
    one version. (Dutch - version 1) The
    item is just made through insert from
    template and filled with information.
    After it is filled with the info,
    Publishing restrictions are set up.
    When this is done and the item is not
    falling within the date of that
    restriction i see standard values @
    front.

Publishing restrictions can be used to make sure information is only shown in some period of time right?
Is this something we can fix in our code? Can we check wheter an item is not in the range of the public resctrictions / unpublished?

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

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

发布评论

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

评论(2

悲欢浪云 2024-08-29 05:32:50

因此,为了让其他用户可以选择检查这个问题的答案,我将回答我自己的问题。

如果 Sitecore CMS 中的用户指定了可以发布项目的范围,并且您看到前面出现标准值:

  • 查找类/呈现显示信息的任何内容
  • 确保您的代码正在检查可用版本

如果像我的情况一样,只有一个版本可用,并且没有其他版本,而今天的日期超出了指定的范围,执行简单的 Item.Empty 检查就足够了。

每当您有需要处理的 Sitecore 项目时:

项目具有上下文语言版本? -> item.Versions.Count

项目可能会被发布? -> !item.Publishing.IsValid(DateTime.Today, false)

项目有布局? -> item.Visualization.GetLayout(Sitecore.Context.Device)

我希望这些信息对某人有用!

So again to give other users the option to check for an answer to this question i'll answer my own question.

If a user in the CMS of Sitecore specifies a range where an item can be published in and you see a standard value appearing on the front:

  • Look up the class / rendering whatever that shows the information
  • Make sure your code is checking for versions available

If there is only one version available like in my case , and there are no other versions while the date of today falls outside the range specified doing a simple Item.Empty check will be enough.

Whenever you have a Sitecore item that you need to handle:

item has versions in context language?? -> item.Versions.Count

item may be published?? -> !item.Publishing.IsValid(DateTime.Today, false)

item has layout?? -> item.Visualization.GetLayout(Sitecore.Context.Device)

I hope this information will once be usefull to somebody!

相思碎 2024-08-29 05:32:50

这是您所描述的行为的可能解释。您的项目有多个版本,当您对正在使用的版本(通常是最新版本)设置发布限制时,该项目将取消发布。如果现在可发布的先前版本之一没有覆盖标准值,您将在前端看到这些标准值。

此问题的解决方法取决于您的需求。例如,如果您希望管理整个项目,请在项目级别设置发布限制。

至于您最初的问题,项目的任何字段都可以通过用户控制/XSL 渲染(例如 sc:fld 函数)来寻址。但请记住,您正在通过渲染查询 Web 数据库。如果设置了发布限制,并且该项目不可发布,您将无法从渲染/子布局中获取该项目及其字段。

希望这有帮助。

Here is the possible explanation of the behavior you described. You have several versions of your item, and when you put publish restrictions to the version you're working with (typically, the latest one), it gets unpublished. If one of the previous versions, which becomes publishable now, doesn't override standard values, you'll see these standard values on the front-end.

The fix for this depends on your needs. For instance, if you wish to manage entire item, set the publish restrictions on an item level.

As for you initial question, any field of an item can be addressed from user control / XSL rendering (for instance, sc:fld function). But keep in mind that you are querying web database from rendering. If the publish restrictions are set, and the item is not publishable, you won't get this item and its fields from the rendering / sublayout.

Hope this helps.

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