I have a chunk that contains a snippet
When I include the chunk in a document the snippet works fine, but if I include it in a module the snippet doesn’t work.
eg:
The code in the module:
$params[’message’] = ’hello’;
$form = $modx->parseChunk(’myChunk’,$params,’[+’,’+]’);
echo $form;
myChunk:
[+message+]
[!mySnippet? &value=`true`!]
When i view the code the i get:
hello
[!mySnippet? &value=`true`!]
So the param replaced ok but the snippet doesn’t get parsed/called/executed
Any ideas
Thanks
Mike
-
☆ A M B ☆
- 24,524 Posts
Module code doesn’t get passed through the document parser, so snippets won’t get evaluated. All the parseChunk does is replace placeholders as specified in its parameters. You would have to write your own code to parse the chunk for snippet tags, then run them through the runSnippet function.
OK, thanks, will give that a go.
Cheers
Mike