Answer the question
In order to leave comments, you need to log in
How to display the tv value of a context resource in a snippet?
So I get the data of a specific tv in the snippet. $modx->resource->getTVValue('weneed');
full code and purpose of the snippet (calculate percentages):
<?php
$priceHave = $modx->resource->getTVValue('wehave');
$priceNeed = $modx->resource->getTVValue('weneed');
$procent=$priceNeed/100;
$result=$priceHave/$procent;
echo round($result,2);
Answer the question
In order to leave comments, you need to log in
$resource = $modx->getObject('modResource', $resourceId);
$priceHave = $resource->getTVValue('wehave');
$priceNeed = $resource->getTVValue('weneed');
......
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question