Pages

Showing posts with label rendertag. Show all posts
Showing posts with label rendertag. Show all posts

Thursday, May 8, 2014

Rendertag to Escape Double Quote and Single Quote

This is a solution posted by Tim Davis on https://groups.google.com/forum/#!topic/reddot-cms-users/ImqWdAN4XIY

You want to assign text placeholder content class a server side preexecution variable, but the text placeholder contains double quote, single quote and carriage return, which will cause preexecution error because the resulting code will be like this

Dim MyVar

MyVar = "<%txt_body%>"

'resulting code
'this cause syntax error, cannot have unescape quote inside quote
MyVar = "he says,"hello""

'this cause syntax error, cannot unclosed second line
MyVar = "first line
               second line"

What you can do is to use rendertag to escape the text. This method handles, &, ", ', accented character like (á, é, í, ó, ú, ü, ñ, ¿, ¡), and new line carriage return

Dim MyVar

MyVar = "<%!! Escape:HtmlEncode(<%txt_body%>) !!%>"

Thursday, January 31, 2013

Foreach Rendertag in Text Array Processing

<reddot:cms>
<foreach itemname="ArrayItem" object="Escape:Text(Test1,Test2).Split(Escape:Text(,))">
 <htmltext>
  <h2><%!! Store:ArrayItem !!%></h2>
 </htmltext>
</foreach>
</reddot:cms>

Thursday, March 22, 2012

Rendertag, Project Performance, Product Support

Project performance is closely tied to rendertag usage.  Here are some rendertag usage best practices that should be taken into consideration when implementing a project.

Store:Set( key, val )
This is a rendertag that allows storage of variable, but it is unofficial and unsupported. Should projects experience performance or content output issues while using this rendertag, product support may be denied or delayed due to slow priority since it not a product issue but an implementation issue.

Additionally, upon full site publish or multiple users accessing the same Store value may experience a race condition since everyone is trying to write and read from the same variable.  For example, generated link for Page B links to Page A because the link value was read milliseconds before it was updated.

.Elements.GetElement(), .GetPathArray()
A page object get loaded into memory prior to any page info marshaling/inspection call, wide usage in project cause the server to use up memory much quicker.  Since the memory garbage collector in .NET could not keep up with the clean up, server tend to become unresponsive more often.

Another issue with rendertag and this rendertag in particular is caching.  Content retrieve via rendertag get cached, but the cache do not get update notification upon targeted content change, hence rendertag continues to display old content.  Please note, this issue do not occur if rendertag is used within navigation template.

Foreach and Store
Content retrieved within foreach rendertag will experience caching issue.  Content output within foreach rendertag via Store rendertag will experience race condition upon heavy multiple access.

Wednesday, December 7, 2011

Navigation Emulation

What is it?

Allow a page, even a non navigation page, to display the exact navigation area as displayed on any page.

Why is it useful?

When a page is not in navigation manager, the page cannot display navigation because it is not part of navigation manager.

However, a page should not be in navigation manager simply because it needs to display navigation. For example, news article pages should not be in navigation manager because number of navigation pages in navigation manager negatively impacts project performance.

However, news article pages must display navigation area for the shake of accessibility. Hence, news article page can use navigation emulation to emulate the navigation of its parent page, the new archive page.

Simple Method

<!IoRangeDynLink>
<!IoRangeNoRedDotMode><!IoRangeRedDotMode><%anc_link%><!/IoRangeRedDotMode><!/IoRangeNoRedDotMode>
<%!! Navigation:OutputArea(LeftNavArea, Bool:True, Guid:<%inf_page_guid%> !!%>
<!/IoRangeDynLink>

 Advanced Method

<reddot:cms>
 <if>    
  <query valuea="Context:Indexes.GetIndexByPage(Context:CurrentMasterPage).GetRootIndex().Id" operator="==" valueb="Context:Indexes.RootIndexList[Int:0].Id">
   <!-- This Page is in Navigation Structure -->
   <htmltext>
    <%!! Navigation:OutputArea(Left Navigation, Bool:False, Context:CurrentMasterPage.Id, Bool:False) !!%>
   </htmltext>
  </query>
  <query valuea="Context:Indexes.GetIndexByPage(Context:CurrentMasterPage.MainLink.OwnerPage).GetRootIndex().Id" operator="==" valueb="Context:Indexes.RootIndexList[Int:0].Id">
   <!-- The Page 1 Level Up is in Navigation Structure -->
   <htmltext>
    <%!! Navigation:OutputArea(Left Navigation, Bool:False, Context:CurrentMasterPage.MainLink.OwnerPage.Id, Bool:False) !!%>
   </htmltext>
  </query>
  <query valuea="Context:Indexes.GetIndexByPage(Context:CurrentMasterPage.MainLink.OwnerPage.MainLink.OwnerPage).GetRootIndex().Id" operator="==" valueb="Context:Indexes.RootIndexList[Int:0].Id">
   <!-- The Page 2 Levels Up is in Navigation Structure -->
   <htmltext>
    <%!! Navigation:OutputArea(Left Navigation, Bool:False, Context:CurrentMasterPage.MainLink.OwnerPage.MainLink.OwnerPage.Id, Bool:False) !!%>
   </htmltext>
  </query>
  <query valuea="Context:Indexes.GetIndexByPage(Context:CurrentMasterPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage).GetRootIndex().Id" operator="==" valueb="Context:Indexes.RootIndexList[Int:0].Id">
   <!-- The Page 3 Levels Up is in Navigation Structure -->
   <htmltext>
    <%!! Navigation:OutputArea(Left Navigation, Bool:False, Context:CurrentMasterPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.Id, Bool:False) !!%>
   </htmltext>
  </query>
  <query valuea="Context:Indexes.GetIndexByPage(Context:CurrentMasterPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage).GetRootIndex().Id" operator="==" valueb="Context:Indexes.RootIndexList[Int:0].Id">
   <!-- The Page 4 Levels Up is in Navigation Structure -->
   <htmltext>
    <%!! Navigation:OutputArea(Left Navigation, Bool:False, Context:CurrentMasterPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.Id, Bool:False) !!%>
   </htmltext>
  </query>
  <query valuea="Context:Indexes.GetIndexByPage(Context:CurrentMasterPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage).GetRootIndex().Id" operator="==" valueb="Context:Indexes.RootIndexList[Int:0].Id">
   <!-- The Page 5 Levels Up is in Navigation Structure -->
   <htmltext>
    <%!! Navigation:OutputArea(Left Navigation, Bool:False, Context:CurrentMasterPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.MainLink.OwnerPage.Id, Bool:False) !!%>
   </htmltext>
  </query>
 </if>
</reddot:cms>