Grab Content That Is In Target Container

61 views
Skip to first unread message

Walter

unread,
Aug 9, 2011, 8:52:18 AM8/9/11
to reddot-c...@googlegroups.com
I've learned so much by searching through all the archives on this group, so I want to contribute with the solution to a problem that faced recently.  In the master page, I needed to access an element from the sub-page in the target container.  The following thread got me on the right track: https://groups.google.com/d/topic/reddot-cms-users/2lXRvI6QfLs/discussion

Here's what I did.

- Create new info element for GUID of the page...  <%info_target_container_guid%>
- Make sure to check "use data of target container"
- Use the following render tag to grab whatever element in the target container that you need:
<%!! Context:Pages.GetPage(Guid:<%info_target_container_guid%>).Elements.GetElement(std_content_element).GetHtml() !!%>

It's simple, and might not be the best way, but it works.  I like that it doesn't require PreExecute.  Hope that this helps somebody in the future.

- Walter

Jian Huang

unread,
Aug 9, 2011, 9:41:59 AM8/9/11
to RedDot CMS Users
Hi Walter,

Nice work and thank you for sharing.

Was wondering if <%!!
Context:CurrentMasterPage.Elements.GetElement(std_content_element).GetHtml() !!
%> would work also.

-Jian

On Aug 9, 8:52 am, Walter <walter.m.wil...@gmail.com> wrote:
> I've learned so much by searching through all the archives on this group, so
> I want to contribute with the solution to a problem that faced recently.  In
> the master page, I needed to access an element from the sub-page in the
> target container.  The following thread got me on the right track:https://groups.google.com/d/topic/reddot-cms-users/2lXRvI6QfLs/discus...

Walter

unread,
Aug 10, 2011, 9:15:58 AM8/10/11
to reddot-c...@googlegroups.com
Thanks for the suggestion Jian, but it doesn't work.  Is CurrentMasterPage supposed to be able to access elements that reside on a sub-page inside the target container?

Jian Huang

unread,
Aug 10, 2011, 9:39:52 AM8/10/11
to RedDot CMS Users
Hi Walter,

Sorry, I misread your original question.

Since the info placeholder has "use data of target container", and I
assumed the code lives in a sub page. I assumed you are trying to
grab content from the parent/foundation page.

CurrentMasterPage, regardless of where the code is (foundation or body
module), returns the foundation page.

-Jian

Walter

unread,
Aug 10, 2011, 9:43:24 AM8/10/11
to reddot-c...@googlegroups.com
No problem, that's what I originally thought.  :)  Thanks!

- Walter

Reddotter

unread,
Aug 11, 2011, 10:22:22 PM8/11/11
to RedDot CMS Users
Hi Guys
Apparently there is a bug with reddot ver9. The method
doesnt seems to work if the page is sitting directly under the target
container. This only work for pages hanging off the list (assigned
target container).
For the earlier senario, the below will help page that sit in the
target container
<%!! Context:Pages.GetPage(Guid:<%inf_page_guid
%>).Elements.GetElement(con_main).Value[Int32:0].Elements.GetElement(stf_page_description).Value !!
%>
For pages that hang under list use this instead
<%!! Context:Pages.GetPage(Guid:<%inf_page_guid
%>).Elements.GetElement(stf_page_description).Value !!%>

So therefore there might be a condition check needed to deter if page
sit in container or hanging off the list

Cheers
Rexcel
Reply all
Reply to author
Forward
0 new messages