We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52804
    • 36 Posts
    How do I get a template variable caption from the API? - Tried this but it doesn't work...

    $caption=$modx->getObject('modTemplateVar', array('caption' => $tv));

    Any help would be much appreciated... Thanks
      • 44064
      • 185 Posts
      Quote from: robh76 at Aug 05, 2018, 07:26 AM
      How do I get a template variable caption from the API? - Tried this but it doesn't work...

      $caption=$modx->getObject('modTemplateVar', array('caption' => $tv));

      Any help would be much appreciated... Thanks

      Hi Rob,
      $caption = $modx->getObject('modTemplateVar', array('name'=>'name_of_tv'))->get('caption');
      
      [ed. note: himurovi4 last edited this post 5 years, 9 months ago.]
        Anton Tarasov
        MODX Developer

        Email: [email protected]
        Web: antontarasov.com
        • 52804
        • 36 Posts
        Quote from: himurovi4 at Aug 05, 2018, 08:09 AM
        Quote from: robh76 at Aug 05, 2018, 07:26 AM
        How do I get a template variable caption from the API? - Tried this but it doesn't work...

        $caption=$modx->getObject('modTemplateVar', array('caption' => $tv));

        Any help would be much appreciated... Thanks

        Hi Rob,
        $caption = $modx->getObject('modTemplateVar', array('name'=>'name_of_tv'))->get('caption');
        

        Perfect... Thank you so much smiley
          • 44064
          • 185 Posts
          Quote from: robh76 at Aug 05, 2018, 08:59 AM
          Perfect... Thank you so much smiley
          Nps, you're welcome smiley
            Anton Tarasov
            MODX Developer

            Email: [email protected]
            Web: antontarasov.com