Thanks for your answer. It got me thinking, which is usually good. I interpeted the structure of the getResource snip and by reading the MODx API last knight (pun intended) I found that I can, by using a string, build my own chunk on-the-go.
As we know, the getChunk and parseChunk basically find a resource chunk from the database or ftp/file structure. By replacing that method with the inline method I was trying to use, I came up with the following:
<?php
/**
* @author ReSpawN
* @copyright 2010
*/
$chunk = $modx->newObject('modChunk', array('snippet' => '[[+test]]'));
return $chunk->process(array('test' => 'This a inline test chunk'));
// For MODxCMS forum; it can also be used like this
$chunk = $modx->newObject('modChunk');
return $chunk->process(array('test' => 'This a inline test chunk'), '[[+test]]');
?>
Both methods are valid, but if you like to parse the chunk before outputting, like, let’s say, applying a plugin, your own replacement code or something like that, you need to use the first method, as the chunk is then already compiled.
I found my answer and I also hope this helps someone else.
Then again, on a whole diffirent but actually similar subject I’m still stuck with the set and unset placeholder method. I’ve created a snip this morning that simply assings a mt_rand value from php, from 0 to 1000. I assign it to [[+test]], or ’test’ if you will, and then echo out [[+test]] in the resource underneath the snippet and repeat the same process 3 times. Every time, I unset the ’test’ placeholder before I set a new one (setting a new one should actually replace the old one, but ok) but it still echo’s the same (eg: 518). I’m not yet sure how these two methods work. Echo’ing $modx->_placeholders; definitly shows the variable but the value is the same.