Book a Demo

Author Topic: Is it possible to call a template where the template name is held in a variable?  (Read 4991 times)

Jeff Hegedus

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
I want to have a template that takes the name of another template to call as a parameter and then calls that parameter with the result of some other processing.  I tried the below but it doesn't work.  It just prints out the string "=%ReturnInputPlusJJH("testString")%" instead of executing it as a call to the child template.  Is what I'm trying possible?  Does anyone know how to do it?

--------------------------------------- Main -----------------------------------------------------
Code: [Select]
$templateName="ReturnInputPlusJJH"
%CallPassedInTemplate($templateName)%
--------------------------------------- Main -----------------------------------------------------

-------------------------------- CallPassedInTemplate -----------------------------------------
Code: [Select]
$templateToCall=$parameter1

$testString="testString"
$templateCall=$templateToCall+"("+%qt%+$testString+%qt%+")"
$returnValue=%$templateCall%
$returnValue
-------------------------------- CallPassedInTemplate -----------------------------------------


-------------------------------- ReturnInputPlusJJH -------------------------------------------
Code: [Select]
$returnValue=$parameter1+"JJH"
$returnValue
-------------------------------- ReturnInputPlusJJH -------------------------------------------

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
No, it's not possible.