Conversation
parse more than 5 snippets call in emailTpl
|
Thanks for this @Bournwog. Are there any specific tests that come to mind to make sure this doesn't introduce any new issues? |
|
I know the parser a bit.. It seems to be a right thing :-) saw that stuff before 👍 |
|
@Bournwog why not use |
|
What if the parser isn't loaded (theoretical it can be possible)? public function getParser() {
$parserClass = $this->getOption('parser_class', null, 'modParser');
if(isset($this->parser) && is_object($this->parser) && $this->parser instanceof $parserClass) {
return $this->parser;
}
return $this->getService('parser', $parserClass, $this->getOption('parser_class_path', null, ''));
}
|
|
@bertoost i'm talking about this in the PR // parse all cacheable tags first
$this->modx->getParser()->processElementTags('', $str, true, false, '[[', ']]', array(), 10);
// parse all non-cacheable and remove unprocessed tags
$this->modx->getParser()->processElementTags('', $str, true, true, '[[', ']]', array(), 10); is there a problem with |
|
I think I copied this from a place somewhere else :-) |
|
Also; when I look logical; $this->modx->getParser();
$this->modx->parser->processElementTags('', $str, true, false, '[[', ']]', array(), 10);
$this->modx->parser->processElementTags('', $str, true, false, '[[', ']]', array(), 10);
Should be fine too.. |
|
i guess i don't understand the need to call |
|
Yes indeed. As said.. Theorethical it's possible that it isn't loaded. Always good to call the load method. That said; I also think the getParser() method should be improved, to avoid double loadings |
|
+1 on getParser() only getting an instance if not already loaded or a different parser class is specified |
when I add 10-20 snippet calls in emailTpl, only 3 or 5 first calls will be processed
with this patch you can use correctly more than 5 snippets calls in emailTpl