Quote from: StevenLangbroek at Jul 15, 2010, 08:57 AM
is this the proper parsing order? I somehow feel like this is a bug, and that the entire content should be parsed before it should be ran through the output-filters...
The problem is, anything that is non-cacheable cannot be parsed until all cacheable content has been prepared for the cache to be created from. So by default, parsing skips non-cacheable content. This is why I said you would need to use a Snippet to do this and duplicate some of the code in modResponse::outputContent(), because this is the code that is responsible for processing the non-cacheable tags. This, in particular is what I am talking about (lines 60-64 in core/model/modx/modresponse.class.php):
<?php
/* collect any uncached element tags in the content and process them */
$this->modx->getParser();
$maxIterations= intval($this->modx->getOption('parser_max_iterations', $options, 10));
$this->modx->parser->processElementTags('', $this->modx->resource->_output, true, false, '[[', ']]', array(), $maxIterations);
$this->modx->parser->processElementTags('', $this->modx->resource->_output, true, true, '[[', ']]', array(), $maxIterations);
?>
This does two passes of up to 10 iterations each, first processing non-cacheable tags and then processing then again with the option to remove unprocessed tags as it goes.
But, there are other considerations as well when trying to process content from the page it was intended to run on vs. pulling it in from somewhere else. Registered javascripts, inline javascript, etc. There are a lot of potential problems if you just try to do this. IMO, it’s better to create an already cleansed summary ahead of time, not when a page is being rendered (even if cacheable).