The ID of the TV is shown in parentheses next to the TV's name in the Elements tree (assuming that the TV shows up in the tree. If not, or if you need to get it dynamically, you could get the ID like this:
<?php
$tvObj = $modx->getObject('modTemplateVar', array('name' => 'MyTv'));
$tvId = $tvObj->get('id');
return $tvId;
FYI, PHP code has to go in a snippet for what you were trying to do. So if the code above was in a snippet called 'GetTvId', you could display it by putting this tag in a chunk, resource, or template:
The snippet tag would be replaced by the return value of the snippet.
BTW, the term "resource ID" is usually used only to refer to the ID of a Resource, not a TV. For a TV, it's just the ID of the TV.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html