7

We have an application that is going through a number of the Components in one Publication (the Source) and if they are published to a specific Publication Target, publishing them to another Publication (the Destination).

The application works fine for the majority of Components however we noticed it was missing about 1/3 of the Components from the Source we had expected it to pick up. At first glance it appears that when the application checks to see if a Component is published in the Source Publication it sometimes gets back False for Components that are actually published.

Here is a snippet of code similar to what we're doing in our app:

static SessionAwareCoreServiceClient CORE_SERVICE = 
        new SessionAwareCoreServiceClient("netTcp_2011");

using (var client = CORE_SERVICE) {
    if (client.IsPublished("tcm:10-259165", "tcm:0-3-65537", true)) {
        // Do some stuff 
    }
}

So the interesting thing is that when we go to one of these Component in the Source Publication, the GUI shows the icon indicating it is published:

Component in UI

But when we do a 'Where Used' on the Component in that Publication it shows it as not published anywhere:

Where used published to for the component

Then, when we run a query against the CM database select * from item_states where item_reference_id = 259165 we get back a number of results showing the Component does have some Templates Published to the target in question (Publication Target '3'):

What the CM DB has for the component being published to

And finally, we can of course see the Component Presentations for this Component published to the Content Delivery DB for the target in question.

Any idea what might be going on here? It has me flummoxed and while we have a work around (just get the list of Components from the Content Delivery DB) we would like to understand what is going on and if it might be an indication of something going wonky with our CM DB or not.

1
  • I answered how we can get mismatches between published component presentations, but I'm not sure why you're not seeing where the item is published. Could it be permissions? How are you publishing it? Commented Oct 1, 2013 at 15:27

2 Answers 2

5

The key here is that - from a CM point of view - you never publish components - you publish Pages and you publish Component Presentations.

You will likely find a correlation between the components that your core service app determines to be published, and the components that you have published with a Dynamic Component Template.

If you want to know if a given component has been published, the only real absolute way to know is to check the broker DB. If you really want to calculate this on the CM, then the logic must check if the component is in a page that has been published (and then it all gets murky when checking if the page actually had the component in it the last time it was published).

5
  • A lot of these components do live on a page that has been published but publishing the page doesn't publish the dynamic component presentations, those are always published separately. Commented Oct 1, 2013 at 8:00
  • And you are right, there is an almost 100% correlation between the components the app determined to be published and the components that we published with DCTs. But there is also an almost 100% correlation between the components it didn't think were published and ones which we published with DCTs. Argh. Probably not the things I should be thinking about at 4:00am. Commented Oct 1, 2013 at 8:02
  • I don't think it's possible (out-of-the-box or without a custom resolver) to publish a page but not publish the embedded DCPs on it. You can choose not to add images to the package, though. What does publishing the page show in "items to publish?" Commented Oct 1, 2013 at 19:25
  • @AlvinReyes I should have been clearer. We use static component presentations on our pages but the same components (Article components in this case) also have dynamic component presentations that we publish separately from anything we do on the pages by publishing the component itself (hence rendering all DCPs.) Commented Oct 1, 2013 at 20:23
  • Ah, got it. No DCPs should publish with the pages but the pages might publish when you queue the components. I'm now thinking someone is publishing the items from the source where the templates don't exist. If not, check with support or let's look at each templates details. :-) Commented Oct 2, 2013 at 0:45
2

The difference might be how the DCPs are published.

By Queuing a Page

If publishing a page, any component paired with a dynamic template is published as a DCP, specifically with just the dynamic template used on the page

Example: queuing an "index page" will: * publish article + summary DCPs * ignore any other dynamic templates for the article schema (it won't publish article + full DCP).

Publishing pages with DCPs should publish the DCPs embedded on it plus any you reference from template code with RenderComponentPresentation() (surprise!).

Note: the DCPs are resolved and show in Items to Publish, but DCPs added by RenderComponentPresentation() get published "quietly." Pages publishing DCPs is a good idea because authors publishing a page want the content to also update.

By Queuing a Component

"Publishing" components on their own publishes all dynamic template variations (one DCP per component x template so you'll see both article + summary and article + full DCPs in the broker).

So you can get into interesting scenarios when a page publishes certain DCPs, but separately published components overlap.

Especially in cases where we mix dynamic and static embedded presentations, it's probably best for authors to publish pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.