well,
$myBrand = '[[*Brand]]';
echo $myBrand;
echoes just
and the MODX - parser replaces it with the value of the TV.
there are two ways to get the value into your snippet:
[[yourSnippet? &myBrand=`[[*Brand]]`]]
Than you can use it inside your snippet with
$output = '';
if ($myBrand == 'Brandname'){
$output = 'hello';
}
return $output;
or better:
$myBrand = $modx->getOption('myBrand',$scriptProperties,'');
$output = '';
if ($myBrand == 'Brandname'){
$output = 'hello';
}
return $output;
Or you use the API to get the TV - value with
$myBrand = $modx->resource->getTVValue('Brand');
if ($myBrand == 'Brandname'){
$output = 'hello';
}
return $output;
[ed. note: Bruno17 last edited this post 13 years, 2 months ago.]