Bug reports
Version 3.x > Bug reports > Implementation of CMSEditableImage LoadContent broken View modes: 
User avatar
Member
Member
christoph walcher - 10/22/2008 8:13:31 AM
   
Implementation of CMSEditableImage LoadContent broken
The implementation of CMSEditableImage LoadContent reads the content of editable regions of parent pages in a loop in case content inheritance is enabled. The flaw in this implementation is that the first non empty content stored in the editable region is stored in the "local" content variable, the current page info is stored in the "info" local variable.

In the later if statement you will check if the "info" instance is published (among other conditions) and only load the content in case the info instance is published.

The problem of this implementation can be illustrated with this example - we have three page levels and an CMSEditableImage on the page that is inherited.

page.level1 (published)
page.level2 (non published)
page.level3 (published)

In case no Image is selected in "page.level3" the CMSEditableImage selects the image content from "page.level2" (for our example this page has an image selected but is not published) but the image is not displayed on the page since this page is not published!

In case "page.level1" has a valid image set this image is NOT shown on "page.level3" which is IMHO against the logic of content inheritance.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/22/2008 8:55:18 AM
   
RE:Implementation of CMSEditableImage LoadContent broken
Hi,

At first, the selected image have to be published as well.

The parent document have to be published also since if something is not published, that means it should not be visible on the live site - so also on the child node it cannot be displayed.

Also, I assume that you are using ASPX templates. In this case the inheritance is little bit more complicated and is working different.

If you are using the same template for all three documents (e.g. the template is inherited), please enter to the code behind of this template this code:

protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
<editableImage_ID>.LoadContent(CMS.PortalEngine.PageInfoProvider.GetPageInfo(CMS.CMSHelper.CMSContext.CurrentSiteName, "<alias path to the parent>", "en-us", null, true, CMS.DataEngine.ConnectionHelper.GetConnection()));
}

If these documents have different page templates, you need to place this code to the code behind of these templates and also you need to place an EditableImage control with the same ID as the parent control.

Best Regards,
Juraj Ondrus