When are a slot's contents updated?

The following is in a Rhythmyx 6.5.2 installation.

We have the following scenario:

  • A content type Article with a corresponding snippet template
  • An auto slot ArticlesSlot that populates with a list of Articles based on certain criteria, formatting each entry in the list with the snippet template
  • A content type ArticleList that specifies the criteria for a list of articles
  • A template ArticleListTemplate that uses the ArticleSlot to display the list
  • A content type GenericPage with a corresponding page template

We are using these as:

  • Create several content items of type Article
  • Create a content item of type ArticleList
  • Create a content item of type GenericPage that includes the ArticleList through the Inline_Variant slot

The problem:
If have this set up, the correct content items show as expected. But if I then make changes to one or more of the articles, those changes show up in the preview of the Article, and in the preview of the ArticleList, but they do not show up in the preview of the GenericPage that’s using the ArticleList.

Is this expected behavior? If so, what do I need to do differently to have changes to the Article show up when I preview the GenericPage containing the ArticleList? If not, any suggestions of where to start troubleshooting this?

All suggestions appreciated. Thanks.

The slot contents will be updated when the ArticleList is re-assembled. This SHOULD happen when you publish, especially since you’ve got an autoslot.

If it’s not happening in Preview there are 2 things you should try:

  1. Flush the cache: go to /Rhythmyx/admin/console.jsp and type the “flush cache” command.

  2. Try this with a slot other than the Inline slot and see if the results are different for inline vs regular slots.

Let us know the results.

Dave

Here’s the results…

  1. Flush the cache: go to /Rhythmyx/admin/console.jsp and type the “flush cache” command.

I tried flushing the cache first, and it doesn’t appear to have changed anything. So I moved on to #2

  1. Try this with a slot other than the Inline slot and see if the results are different for inline vs regular slots.

We don’t actually have any regular (i.e. non-inline, non-auto) slots that are in use in our system. So I created one to test this. I created a slot named testNonInlineSlot using the RelationshipContentFinder and included the ArticleList type with its snippet template in the Allowed Content for the slot. I then added the slot into the Generic page template. I used the Active Assembly to put an ArticleList content item into the slot on a Generic content item that also has an ArticleList in an inline slot (so I could do a side by side comparison of the behaviors).

As it turns out, there is a difference. When I make changes to one of the Articles that populates the ArticleList, and then Preview the Generic page, the ArticleList that’s displayed through the inline slot does not show the changes, but the same list displayed through the regular slot does show the changes.

Does this information suggest anything I could do to fix how it works through the inline slot? The way our pages are structured, we would really prefer to use inline slots, so the list can be included in the middle of the body of the page as our web content editors have requested.

I haven’t checked yet whether it gets the correct information when the page is published yet; that’s my next step. But I wanted to go ahead and posts these results, in hopes that they might spark a suggestion for fixing this.

Thanks.

Edit: I published the Generic page to our staging database, and it did not get the current content of the Articles in the ArticleList.

The inline content in the body may not be getting replaced for some reason.
To check this try inserting the same variant again in the same generic page item. Update the item and check whether you have diffrent content for inline variants.
Another thing to check is whether you have checked in the Article item or ArticleList item.

You are correct; the problem is that the inline content in the body is not getting replaced for some reason. The tests Dave suggested confirm that. Now it’s just a matter of figuring out what reason.

I have tested inserting the same ArticleList again into the Generic page, and it does get the current content of the Articles on a fresh insert. But it would be highly impractical to have to update every Generic page containing an ArticleList whenever an Article changes.

Also, all the content items I have been working with have been checked in after each change to them, so it’s not an issue with things still being checked out.

So… we’ve been able to track down what seems to be causing the problem, though the answer is very very odd.

It turns out that the ArticleList snippet template didn’t have <div></div> tags around the contents of the template like some of our other templates do. Evidently regular slots handle this just fine, but the inline slot really doesn’t like it. As a (hopefully temporary) fix, I’ve added the <div></div> tags around the contents of the template, and now the changes show up in the Preview as they should.

But this leads me to another question… putting those <div></div> tags there makes them show up as part of the HTML that is generated for the page, and that throws off the structure of the body of the page. It’s workable, but it’s not ideal, especially when it comes to applying CSS styles to page structures, or to the content authors (who are only borderline tech-savy) understanding what they’re seeing.

Is there any way to do this without the <div></div> tags there? Or to at least not have the tags end up folded into the assembled page?

Preview the ArticleList item and view source and post it here.
And also, open the GenericPage item that has the inline variant, click on the field that has inline variant and switch to code view and post the content from it.

The template output must have one top level element under body inorder to work properly as inline variants. That is a requirement. Try surrounding the content in a span tag.

Just to elaborate a little on what JB said…

All Snippets that are included “inline” (that is, in a body field) must be well-formed XML. The reason for this is that we use a SAX parser to scan the field for inline links, and any failures to parse will either cause errors or result in the content not being updated properly, as your experience demonstrates.

One of the requirements for a well-formed XML document is that it must have a single “root” node.

The snippet mechanism is supposed to transparently strip off <html> and <body> tags, so one thing you can try is giving your snippet template <html>, <head> and <body> tags just as if it were a regular HTML page. This will assure that the snippet has a single root (e.g. the <html> tag).

BTW, in older versions of Rhythmyx this was a requirement for ALL snippets, not just ones that are included inline.

I hope this helps.

Dave

I had heard about the requirement that there be a top level element surrounding the contents of the template before. So we’ve tried this a couple different ways.

All our snippets have html, head, and body tags as if they were a full HTML page. Without any other tag inside the body surrounding template content, the snippet cannot be used inline at all. When you insert it into another content item, it just inserts the attributes and values as opposed to the whole div that usually gets inserted with a working inline snippet.

With a span tag surrounding the template contents inside the body tag, the snippet gets inserted properly inline, but it doesn’t get updated. This is actually exactly the scenario that led me to start this thread… we had span tags instead of div tags to try to interrupt the structure of the page less. It appears that it’s fine, until you try to see the updates.

I may experiment with this more when we’re not under as tight a deadline. Thanks to you both for all the information and suggestions. At least now we know what we’re dealing with, even if there isn’t an ideal solution readily apparent.