I’m not quite sure what you are trying to do, but you probably have to override the get() method (or maybe getlist() or read()) of the class modRestController.
As you can put all your code in those functions, there is no need to even use a snippet.
<?php
class MyControllerHello extends modRestController {
public function beforePost() { return false; }
public function beforePut() { return false; }
public function beforeDelete() { return false; }
public $classKey = 'modResource';
public $defaultSortDirection = 'ASC';
public $defaultSortField = 'id';
public function prepareListObject(xPDOObject $object) {
$data = array();
$data['id'] = $object->id;
$data['pagetitle'] = $object->pagetitle;
$data['content'] = $object->content;
$data['introtext'] = $object->introtext;
$data['longtitle'] = $object->longtitle;
$data['description'] = $object->description;
$data['snippet'] = $object->$modx->runSnippet('hello');
return $data;
}
}
also the $data[‘snippet’] line fails and 500’s so thats what I was wondering was something I could do?
I guess I am starting small and just trying to get that to work but what I’d love to do future tense but didn’t wanna get that deep till I understood a bit more was, i wanted to just have a input for image, that would process by a snippet that would run something like phpthumb and give me back a URL of the image after its been manipulated, that way I can do the processing from the MODX side and the return JSON would contain the compiled / processed image at whatever dimentions i’d setup in the snippet.
am i not on the right track for that type of thing or can you think of a better way to get a processed phpthumb image into a string into a json key
sweet brother! that works! thanks! Do you think I am on the right track with what i explained? get a snippet going and pass the data? appreciate your help!