GetElementByName(con_Body).Value[Int:0] when more than one page attached to container

154 views
Skip to first unread message

cburne

unread,
May 14, 2013, 4:27:11 PM5/14/13
to reddot-c...@googlegroups.com
Hi;

I didn't see this anywhere else already so asking to the group:

This works to get a handle on a page when there is only one page in the container as in:
GetElementByName(con_Body).Value[Int:0].GetElementByName(txt_Whatever).GetHtml()

However, when there is more than one page attached to the container, it does not return anything.  I was expecting Value[Int:0] to return me the first page and Value[Int:1] to return me the second page.

Am I missing something?  Is there another way to get a handle on a specific page in the collection or do I need to do a foreach loop?

Thanks for the help.

Christian Burne
Oshyn

Jian Huang

unread,
May 14, 2013, 5:59:06 PM5/14/13
to reddot-c...@googlegroups.com, reddot-c...@googlegroups.com
From the project node, action menu, clear page cache.

Do this each time you add or delete a page from con_body.  Welcome to the world of rendertag caching by using anything but if and else rendertag, the only safe rendertag

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reddot-cms-use...@googlegroups.com.
To post to this group, send email to reddot-c...@googlegroups.com.
Visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

cburne

unread,
May 14, 2013, 8:07:38 PM5/14/13
to reddot-c...@googlegroups.com
So I'm accessing the index correctly to get the first item attached to the container?  I ran Clear Page Cache, but I don't see it working yet.  Is there some type of time delay?

Jian Huang

unread,
May 14, 2013, 8:46:44 PM5/14/13
to reddot-c...@googlegroups.com, reddot-c...@googlegroups.com
When it comes to order, there is navigation order and page order.

In version 9 and I think in some version 10, you can change the page and navigation order in a container or list.  Then it was changed in later version that a user cannot change the navigation order unless the page uses a content class that is a master page.

What you see is smarttree is the page order, which is usually the reverse order of navigation order.  Hence, are you sure that the page at int:0 of navigation order has txt_Whatever?

Also, what if the page at int:0 of navigation order is only connected at one location, at con_Body?  If not, well, navigation manager and render tag don't really like page with multiple connections.

Finally, there is better ways to do what you want to do using just blockmarks, which is the current best practice because of all the previous dependencies I mentioned about rendertag

Sent from my iPhone

cburne

unread,
May 15, 2013, 12:26:17 PM5/15/13
to reddot-c...@googlegroups.com
This is great, Jian.  I really appreciate it.

Can you point me in the direction of the blockmark solution you are speaking of?

Jian Huang

unread,
May 15, 2013, 1:06:46 PM5/15/13
to reddot-c...@googlegroups.com
assuming your original code was this and was trying to get just the txt_Whatever of the following page to show somewhere else
<%!! Context:CurrentPage.GetElementByName(con_Body).Value[Int:0].GetElementByName(txt_Whatever).GetHtml() %!!>


reference lst_body to con_body, you can even do that at content class level so next time a user creates a page, it is automatically self referenced.
<!IoRangeList>
<!-- <%lst_body%> -->
<%txt_Whatever%>
<!/IoRangeList>

what if I want to pull through specific page, well, easy, create a unique element for that content class
<!IoRangeList>
<!-- <%lst_body%> -->
<!IoRangeConditional>
<%stf_date_time%>
<%txt_Whatever%>
<!/IoRangeConditional>
<!/IoRangeList>

cburne

unread,
May 15, 2013, 2:37:36 PM5/15/13
to reddot-c...@googlegroups.com
Yes, okay.  The reason I believe this doesn't work for me is b/c the container is in a separate page that is linked to a list that attached to the original page.  So my render tag is actually something like this:

<!IoRangeList>
<!-- <%lst_Products%> -->
<%!! Context:Pages.GetPage(Guid:<%inf_PageGUID%>).GetElementByName(con_Body).Value[Int:0].GetElementByName(txt_summary).GetHtml() !!%>
<!/IoRangeList>

This is the reason I had to go to the render tags in the first place.

Jian Huang

unread,
May 15, 2013, 6:02:33 PM5/15/13
to reddot-c...@googlegroups.com, reddot-c...@googlegroups.com
Ok, there are 2 ways you can still do this.

Way 1
Connect the body page to list_Products and just pull the txt_Whatever.

When generating the link to the product page, do GetPage(...).MainLink.OwnerPage.GetUrl(Bool:True)

Way #2, my favorite way because product listing page is not that SEO critical to me.

Use JQuery AJAX

$.get('lst_Products', function(data){
     alert($(data).find('#WhateverText').text());
});

Sent from my iPhone

Tim D

unread,
May 17, 2013, 12:21:48 PM5/17/13
to reddot-c...@googlegroups.com
With a long term frame of mind, if you'd like an enhanced custom rendertag API to write, in C#, to make functionalitythat could address child/subtree elements and that you could govern how caching would work then you can vote for this idea on SolutionExchange


* Note the top 2 vote-getters to date have been implemented in 11.1 and scheduled for 11.2 respectively.
Reply all
Reply to author
Forward
0 new messages