Getting MODX error from snippet 'can't load resource'

Trying to get a checkbox TV value inside a snippet. Using MODx version 2.7.1

<?php $id = $modx->resource->get('id'); $page = $modx->getObject('modResourse', $id); return $page->getTVValue('tv-name');

Keeps giving me a null value for $page
and givng out this error in the MODx error log

[2019-04-03 10:38:17] (ERROR @ /path/core/xpdo/xpdo.class.php : 644) Could not load class: modResourse from mysql.modresourse. [2019-04-03 10:38:17] (ERROR @ /path/core/xpdo/xpdo.class.php : 1655) Could not load class modResourse! [2019-04-03 10:38:17] (ERROR @ /path/core/xpdo/xpdo.class.php : 644) Could not load class: modResourse from mysql.modresourse.

Is it just a miss-spelling of modResourse in your snippet?

It would be modResource.

1 Like

Looks like the typo indeed :slight_smile:

But you also don’t have to fetch the resource again as it is already available to you in $modx->resource

2 Likes

Thanks for the help gentlemen

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.