How to avoid $ {} in my Tridion component template, which is used by several templates?

I came across a situation where I came across the value of ${test} , in my template of the component that displays this value, it turns out that the problem occurs when another template calls this component and templates using @@RenderComponentPresentation(Component.ID, MyFirstTemplate)@@ at this moment, ${test} is evaluated, and because there is no such element on the component or package, it does not evaluate anything.

  • I have a component template that reads the value of the Component field (which contains: ${test} )

    • This template displays perfectly, I return "$ {test}"
  • Now I have component template 2 that calls @@RenderComponentPresentation(Component.ID, ComponentTemplateOne.ID)@@

    • Here ${test} now gets an estimate instead of saving, so it goes from ${test} to "" because it does not find the field name of a variable or component with that name.
  • Two component template then receives a call using component 3 template in the same way @@RenderComponentPresentation(Component2.ID, ComponentTemplateTwo.ID)@@

    • Since ${test} has already been evaluated and lost in Component Template Two, I no longer finish ${test} , I am still left with "".

I tried:

  • @@RenderComponentField('myField', 0, False, False)@@
  • @@RenderComponentField('myField', 0, True, False)@@
  • @@RenderComponentField('myField', 0, False, True)@@

Bad luck.

Below was my work and it seems to work:

  • Placing "\" in front of the open and closing braces $\{test\}
  • I need to make sure that I delete "\" after the last template (page or component) has been executed.
  • Now I have C # TBB that takes "$ {test}" and does the following:
    • Converts ${test} to $\{test\} to the initial template and C # TBB to the Page Template, which then returns it to the initial value ${test} .

Is there a way to prevent this or do what I do to make this work?

+8
tridion tridion-2011
source share
1 answer

Have you tried this link, you should be able to use this link

 @@"$" + "{" + "test" + "}"@@ 
+4
source share

All Articles