Getting TV value from any resource in Evolution CMS

Problem: How to get a TV value from document A when being on the document B?
Solution: Snippet that uses $modx->getTemplateVarOutput(); 

Snippet

Name: tv
Code:

<?php
// Getting any document TV value
// Usage example: [ [ tv? &tv=`yourTV` &id=`yourDocID` ] ]
// By: Piotr Matysiak / webready.pl

$output = $modx->getTemplateVarOutput(array("$tv"),$docid="$id",$published=1);
$output = $output[''.$tv.''];
return $output; 
?>

Usage example

[ [ tv? &tv=`yourTV` &id=`yourDocID` ] ]

Parameters

  • tv - template variable name
  • id - ID of the target document