We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29860
    • 59 Posts
    Hi

    I’m trying to get a TV from a specific doc but Im not sure what Im doing this right. Here’s my code that I read from some other post here.

    $docObj = $modx->getDocument($docId);
    $outlink = $modx->resource->getTVValue('outlink');
    
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: thiswayup at Nov 10, 2010, 12:25 PM

      Hi

      I’m trying to get a TV from a specific doc but Im not sure what Im doing this right. Here’s my code that I read from some other post here.

      $docObj = $modx->getDocument($docId);
      $outlink = $modx->resource->getTVValue('outlink');
      

      If you want it from a specific Resource, simply do this where $docId is the id of the Resource you want the value from...
      <?php
      $outlinkTV = $modx->getObject('modTemplateVar', array('name' => 'outlink'));
      $outlink = $outlinkTV->renderOutput($docId);
      ?>

        • 29860
        • 59 Posts
        thanks!