3

In my package, i have a list of TcmUri which sometimes contains valid TcmUri but also fake TcmUri such as tcm:0-0-0. slideshareList is the name of my list.

I need to write something like this :

<!-- TemplateBeginIf cond="slideshareList[${TemplateRepeatIndex}] != 'tcm:0-0-0'" -->
@@RenderComponentPresentation(slideshareList[${TemplateRepeatIndex}],"tcm:125-48340-32")@@ 
<!-- TemplateEndIf -->

The TemplateBeginIf does not seem to work because the condition seems to be always verified. I tried to check what slideshareList[${TemplateRepeatIndex}] contains with:

slideshareList[${TemplateRepeatIndex}] returns slideshareList[1] @@slideshareList[${TemplateRepeatIndex}]@@ returns undefined

I don't really know what syntax is possible despite my searches on the internet. Thank you for your time.

6
  • you can try ${String(slideshareList[TemplateRepeatIndex])}, I have not tested it though. Somthing like that worked for me in the past. Commented Jul 25, 2016 at 15:19
  • Thank you for your answer, unfortunately "undefined" is returned :/
    – user1178
    Commented Jul 25, 2016 at 15:24
  • okay, I'd try different combinations of @@, ${ and string(). like String(slideshareList[${TemplateRepeatIndex}]) Commented Jul 25, 2016 at 15:38
  • it returns : String(slideshareList[1]). Not displaying the real value :/
    – user1178
    Commented Jul 25, 2016 at 15:49
  • 1
    Why not fix the TBB that is building your list and make sure you don't add in null URIs, conditions is something which belong in code, and thus in your TBB, not in your layout? Commented Jul 26, 2016 at 12:32

1 Answer 1

4

There is a TBB called Get Linked Components in the Template Base framework for DWT.

You can find it here: https://www.sdltridionworld.com/community/2011_extensions/generic-2011-tbbs.aspx.

It will add those nested components to your package that you can easily access without funky DWT hacks.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.