Sitecore presentation details don't update on template change - templates

I'm working on a Sitecore (6.4.0.101124) site that has two templates used for the home page. These have a very similar structure - the big difference between them is that they each have one different sublayout in the Controls section of the Presentation Details of the Standard Values. My understanding is that when the template is changed on an item the standard values of the template should be applied to that item. However, when the content editors change the template the presentation details remain the same until I go in and change them.
So this means that either I misunderstand how this is supposed to work, or something wonky is happening. This is a very similar problem to what's discussed in this thread, but the answers given don't seem to apply since this item was not created using a branch template.
Has anyone had a similar experience with this (and solved it)? Am I way off base in how this is supposed to work?

You write:
My understanding is that when the template is changed on an item the standard values of the template should be applied to that item.
This is only true if a field has not been edited. Once a field for an item has been edited, the edited value takes precedence over the default. Changing the template to one that has different Standard Values will only have an impact if the field has not been touched, or if the user resets the field to the default value using the Fields Reset button. (Note that manually clearing the field will not do the trick. Sitecore will store an empty string, which will override the Standard Value. By using the Reset button, you set the field to a Database Null, which causes the Standard Value to be used.)
You can tell if a field has been edited by checking for the text "standard value" next to the field in the Content Editor:
Sitecore 6.4.0 and Layout Deltas
Things are more complex with the Renderings field on Sitecore 6.4.0 and above, because Sitecore introduced a feature called "Layout Deltas" with this release. Before Layout Deltas, if you edited the presentation details of an item, Sitecore would copy the layout information from the "Renderings" field of Standard Values into the item's Renderings field, which had the consequence that any subsequent change to Standard Values Renderings would have no effect on the display of this item.
This functionality made it difficult to manage changes to presentation, since a minor change to a detail of presentation on an individual item, such as adding conditional rendering logic, would break the inheritance from Standard Values. If if was necessary to change the presentation of a class of items, it was necessary to first change Standard Values, and then to make the same change to every item that modified presentation.
With Sitecore 6.4's Layout Deltas, if you modify the presentation of an item, just the change is stored in the item's Renderings field, rather than a complete copy of the Standard Values rendering. This change, or delta, information is applied on top of the Standard Values Renderings information, so that modifications to Standard Values layouts are applied to all inheriting items, not just ones with unmodified presentation.
It sounds like your content editors have made a modification to the presentation of the item. When the template is switched, this change is being applied on top of the new template. You can confirm this by checking for the [Standard Values] text next to the Renderings field of the item in question.

The template has values, but what carries the values to the items that are created using that template is in the standard values item. Now, that being said, each field on an item that is created from that template has a flag that says whether or not its using template standard values. If the presentation details are NOT flagged as using standard values still, then its not going to cascade down the updates to the items.
Now.. to be sure that you understand the difference between a branch and a template.. a branch is sort of a "model" of how you can create an item. It is NOT going to cascade changes down when you make changes to the branch item at all. Items will inherit values from their TEMPLATE standard values. The branch values inherit only upon item creation.
EDIT: By the way, I should add that if you turn on the gutter on the left to show presentation overridden, you can see if the presentation values are standard values or not. If you see the icon, then you know the item is not currently using standard values.

I got to this question because I had a field across hundreds of pages which I needed to change. It was not shared to begin with. I tried setting the field to Shared & Unversioned within the template but that did not cause it to change everywhere when I made changes.
I then proceeded to set a Standard Value in the template to what I wanted the field to be, and then selected Versions -> Fields -> Reset after highlighting the Standard Value. The first time I did this, it reset the field to blank. Then I did it again and the field changed on every page which used that particular field. Hope this helps. It seems if you already have a field which wasn't shared to begin with, you need to do a standard value reset to it.

Related

Updating sitecore presentation renderings in standard values messing up the alignment

Initially my template had the header and footer components in standard values. Internally the header and footer has more than 10 child renderings. Now we have updated the header and footer with a single rendering. As soon as we update our standard values presentation details, the pages which got created using this template alignment messed up. The first component in the page getting ( should be displayed after the header) messed up. We are using Sitecore7.2. Does anyone faced this similar issue?
Sitecore stores presentation details as an xml text.
Every component is defined by:
<r
uid="{67F55316-B9FD-4902-9BF2-FAAFF1A54ED9}"
p:before="r[#uid='{41A67DB2-4FBA-4991-90CC-C9A7D789A6CD}']"
s:ds="{BC9968C4-1567-4CC3-BD75-02E4AD6DBDB2}"
s:id="{F096F0DF-083C-4EC2-8C0B-EC0500BF8080}"
s:ph="/main" />
Notice that there are p:before and s:ph attributes.
s:ph tells Sitecore in which placeholder the rendering should be placed.
p:before tells before which component it should be rendered.
If you add a component to Standard Values item presentation details, it changes the p:before of the components on it. And it doesn't know about all the items which uses this Standard Values so it cannot "fix" them.
Also if your item which uses given Standard Values has a component which has p:before value set to a component which you removed, Sitecore doesn't know anymore where to put this component.

Specify order of slides in carousel?

Is there a way to control the order of slides displayed to users in a carousel from the Experience Editor perspective? (or even the Content Editor)
Basically, based on the user that has been identified or not identified, I would like to display a different slide as the first slide of the carousel. All the other slides would still be present, just in a different, specified order.
Is there a way to accomplish this via rules or should I look at having to create separate datasources that have the different slide orders already specified?
TL;DR
Personalization can do three things:
vary a datasource for a rendering
vary a rendering (use another rendering basically)
hide a rendering.
I guess the question you need to answer is whether what you need can be accomplished by doing either one of these actions.
If you've used nested structures to represent your carousel (like we do in SCORE, you can see how it looks like here or here) it's not hard to show/hide certain panels based on personalization conditions and thus reorder the carousel. Depending on how exactly it looks on the published site you may only need to repoint datasources. Either way, it's personalization out of the box and your content structures working nicely together.
If you've used a (variation of a) MultiList field to represent a list of your panels with panels themselves being items somewhere in the shared content area it's not something personalization engine can change based on a condition. Changing a field value is, unfortunately, not on the menu. I am sure you can code around it thanks to Sitecore being so open and flexible but I am not sure you can make it seamless (e.g. variations preview in Page Editor).
Rendering parameters is also not something you can change but if yours are static and defined on the rendering definition item (as opposed to being supplied when component is bound to the placeholder and thus recorded inside the presentation details) you can get away with having two definition items for your carousel component (same code behind it) and picking the right one based on the personalization condition.
Hope it helps.

Changed sitecore template inheritance, all layouts broken

After changing the inheritance structure of a template I seem to have broken every layout on the entire site.
In short we had two content page templates in two different locations. I basically changed templates inheriting from /bad path/Content Page to /good path/content page.
I've set breakpoints in the sublayouts, but basically anything set up in the page editor using placeholders isn't displaying correctly, and the code isn't even getting hit.
* UPDATE *
Here is an interesting warning in the log file
3176 09:05:52 WARN Long running operation: renderContentEditor pipeline[id={xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx}]
Thanks
If your presentation details are set on individual items and not being inherited from the template, a change of template would not generally affect the placeholder settings of the item. It should retain all of its existing item-specific presentation details.
That being said, I would recommend double-checking the items to make sure they are not inheriting from the template and have their own override value (check the Layout field in the Content Editor to see if it says "Standard Values" next to the field name)
The other part of this could be the field access. You mentioned you changed templates inheriting from one content page to another. If your code references fields by ID, your different templates will have different ID values for the same field. So if your "content page" template has a "Title" field, it will not get the data from the "Title" field of your other "Content Page" template. This could cause a lot of errors as you may be depending on the presence of a field. This would usually lead to .NET errors in many cases, however.

How do you do preloading of components

I would like to know how do you do pre-loading of components in sitecore 7.1?
What I tried so far:
Create a standard value for the page.
Then modify the presentation details of the standard value.
Then add components that I want preloaded in the page.
Then create a Branch for the page.
Use the Branch to create the page.
This works fine except when I add new components in the page's standard value, all existing page is affected with my changes.
What I need to know - is there away that the old page is not affected by my changes in the standard value?
Is there a way only the new page that I create is affected when I modify the pre-loading of components in my page?
Your input is appreciated.
There are few things one should consider:
If there current Sitecore installation is upgraded from 6.4 or prior version to your current version; the item's layout deltas might be an issue. You will have to check the raw values of the Layout details field and figure it out.
Any changes made on the Layout Details on Standard Values do get cascaded down to the items created from that specific Template.
If you don't want these changes to get inherited try multiple inheritance. And change the template of those items created.
Lastly, if the above doesn't work, try creating a new template with the changes you want and change the Template of those items created.
Hope the above helps. Share any further questions you might have or even if the above haven't answered your questions.
Happy Sitecoring!
The main purpose of __Standard Values is automatic update of existing items.
In this case, you should not configure the item's layout in the __Standard Values.
You need to use Branch and configure layout in the Page item instead of __Standard Values.

Selecting a datasource item for preset components

Before digging into my explanation i will summarize my question:
How do I provide the user (editor) with a user-friendly possibility to select a datasource item for sublayouts that are preset on the standard values?
My situation is as follows:
I have a page template, with pre-defined layout on the standard values.
Let's say the layout consists of:
one placeholder "wrapper"
one sublayout "content"
This sublayout is pre-defined on my page template, but can also be placed in the placeholder using the Page Editor.
It needs to have a datasource item that defines a Title and Body value.
Now, if a user adds this sublayout to the placeholder using the Page Editor, he will get a nice interface to select or create the datasource item (see screenshot).
However, if the sublayout was pre-defined on the standard values, it will be added without datasource (I can't pre-set the data source in the standard values because it's still unknown by then).
At that point there seems to be no way to get to that nice interface for selecting or creating a datasource item.
Ideally I want to be able to add a field to my template that can hold a datasource item which the user can select/create using the nice interface. I looked at the datasource field type, which could be an alternative, but it's still not exactly what I want.
Bare in mind that the content sublayout is just an example.
I understand that in that specific case I could solve it by always adding a title/body field to the template which hold the values if there is no datasource, but for my real world problem that won't suffice.
I don't have a whole lot of experience with the Page Editor (with the new way of working with it) so I would like to get some advice on this subject.
According to what you said here:
Ideally I want to be able to add a field to my template that can hold a datasource item which the user can select/create using the nice interface. I looked at the datasource field type, which could be an alternative, but it's still not exactly what I want.
It seems you want an intuitive data source selector interface in the CMS shell similar to the Page Editor-based UI.
Quick answer: Simply put, there's nothing that does this for you in Sitecore.
Longer answer: There are still some options for you, e.g.
Define a global "dummy" data source and set that to be the data source set in in Presentation > Layout Details of the template's standard values. So every time you create a new page, it will always point to that dummy value to show something.
From here you can do a few things:
If the user must use the shell UI and not Page Editor, they can simply create another data source item for the specific page and update that page to point to it using the existing native interface in Layout Details.
Another option is to write an event handler, say for item:created or similar that when you create an item, auto-create a corresponding data source item for this specific page (whether this auto-created item be a sub-items or global item...) then programmatically set this to be the data source. A similar concept is shown in this video by Nick Wesselman: http://www.techphoria414.com/Blog/2012/May/Sitecore_Page_Editor_Unleashed