• RedDot CMS Blog
  • 28.02.2020
  • EN

rdb: Quick Tip: Workaround for rendertag: Context:CurrentDepth

In the current (2008) versions, the render tag <%!! Context:CurrentDepth !!%> is not working properly, in some versions it isn’t even recognized as a render tag in the templates.

Today I found a nice workaround for it: 

<%!! Context:CurrentIndex.GetPath(¶).Split(¶).Length !!%>

I practically does the same thing: It reads out the current navigation path (with ‘¶’ as dividing char, as it’s normally not used for page names), splits the resulting string and gets the number of elements returned. Voilá, you’re done.