We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23054
    • 62 Posts
    I defined a template variable ’mailToWebmaster’ (text)
    Now I try to get the text in a snippet like this:

    $mailToWebmaster = modx->getTemplateVar('mailToWebmaster');


    The result is an PHP error message "document.parser.class.inc.php(705) : eval()’d code on line 5"

    That means I did something wrong ?
    So, how to get the value of the template variable ?
      • 10487 MODX Staff
      • 1,535 Posts
      Hi persepolis,

      You’ve missed the dollar sign for the ’modx’ object identifier, try this:

      $mailToWebmaster = $modx->getTemplateVar('mailToWebmaster');


      Hope that helps,
      Garry

        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 23054
        • 62 Posts
        oh grin
        how stupid of me - I often forget this bloody sign and wish the developers of PHP could have choosen any other way to define variables.

        Thanks, now it works as expected