Accessing Template Variable From Snippet in MODX Revolution

If you need to get the value of a template variable (TV) in MODX Revolution from within a snippet for the current resource, you can use

$tvValue = $modx->resource->getTVValue('foo');

More MODX Revolution template variable documentation