How do I render the content of the editable region of the same document but in a different layout us

Jesse Cofie asked on April 29, 2014 07:48

Hello,

I have a site with multiple layouts on a single page template. This is actually for a mobile version on the site. I want to set the default text of an editable region ["editabletext2"] in the mobile layout, to the text found in the editable region ["editabletext1"] in the desktop layout. I read this forum post: http://devnet.kentico.com/questions/how-do-i-render-the-content-of-the-editable-region-of-another-document-using-a-macro which mentions using this macro: CMSContext.CurrentPageInfo.EditableItems["editabletext1"]; So I tried inserting this macro in the "Default Text" field of the ["editabletext2"] webpart and made sure there wasn't any content in this webpart that'll override the default text. But nothing showed when I preview the page. Is there a way I could fetch the content of an editable region on a page template and insert as the default text of another editable region on the same page template but in a different layout?

Thank you..

Recent Answers


Brenden Kehren answered on April 29, 2014 07:57

It may be a visibility issue, if that other webpart or zone isn't available then it may not find the item to gather the text from. Have you tried turning on Debug to see what the macro is doing or returns?

0 votesVote for this answer Mark as a Correct answer

Jesse Cofie answered on April 29, 2014 10:17

@BRENDEN KEHREN Thank you.. I thought as much.. The webpart I want to inherit from, although on the same page template, is in a layout(desktop layout) that is not visible when the mobile layout is visible. Does this also mean there's no work around?

0 votesVote for this answer Mark as a Correct answer

Yehuda Lando answered on April 29, 2014 15:08

Do both layouts have web part zones with the same ID? If they have different IDs, the web parts are not shared.

0 votesVote for this answer Mark as a Correct answer

Jesse Cofie answered on April 30, 2014 02:50

@YEHUDA LANDO... It's not "possible" to have web part zones with the same ID even if they're in different layouts. I tried and I got a "Web part with given ID already exists." error message. But then are you saying there is a way to share/access contents of a web part in a different layout but on the same page template?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.