Hello.
I’m writing an addon which can take an EE template, replace some variables and then *crucially* parse the EE tags in it and then email it.
I was hoping stash:parse might come to my rescue after a day of poking around various addons code and other options.
So here’s what I want to do:
echo "Template following process 1: $msg_body<br>"; if ( ! class_exists('Stash')) { include_once PATH_THIRD . 'stash/mod.stash.php'; } $stash = new Stash(TRUE); // instantiate with initialising
$params = array( 'process' => 'inline', 'parse_depth' => 5 );
$parsed_string = $stash->parse($params, $msg_body); echo "Template following process 2: $parsed_string<br>";
return $parsed_string;
This all seems to work - $msg_body is my template ready to parse. It contains a channel entries tag, which even when I make it as basic as possible, still gives the following error:
Error
The following tag has a syntax error:
{exp:channel:entries}
Please correct the syntax in your template.
The template code is
{entry_id} {exp:channel:entries channel="clients" entry_id="18813" status="not closed" } {title} {/exp:channel:entries}
So unless I’ve missed something obvious, there isn’t a syntax error here.
It seems like this should work, especially as the parse example includes a channel entries tag (https://github.com/croxton/Stash/wiki/{exp:stash:parse})
Unless this only works when using the tag, rather than using Stash in my addon.
Any help/advice appreciated. Thanks.
|