D
D
Darklt2022-03-14 20:07:48
MODX
Darklt, 2022-03-14 20:07:48

How to pull tv parameter with id into a variable?

There are many meanings of tv on different pages. How to extract them into a variable and display echo c id of a specific page in a common snippet?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vlog, 2022-03-14
@vlog

, if I'm not mistaken, then so. But this is in templates and chunks.
If we are talking about snippets, then I recommend reading a series of articles about xPDO , where this process is quite accessible and described in detail. One of the articles contains the following code:

$res = $modx->getObject('modResource', 16);
$tv = $res->getTVValue(4);
return $tv;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question