Normally we would insert snippets, TVs, placeholders, and site variables into a template document using [[]], [**],[++] or [()] respectively.
Cacheable Syntax:
[[Snippet]]
[+Placeholder+]
[(SiteVariable)]
[*TemplateVariable*]
The above elemnts are rendered as html and saved whenever the document is marked as "Cacheable".
We can however execute the above elements inside a cached document by replacing the first bracket ("[") symbol of the syntax shown above with "[ @] " symbol (removing spaces). This will cause the parser to treat such elements as "Active Elements" (non-cached elements) and will render or execute them even when the document is cached. This works similar to non-cached snippets [!!] but is designed to work with other resource elements inside the template:
Non-Cacheable Syntax:
[@][Snippet]]
[@]+Placeholder+]
[@](SiteVariable)]
[@]*TemplateVariable*]
With this syntax snippets, tvs, etc found inside a cached document will be able to function as they normally would if the document was not cached. This means that the $modx->documentObject will be available to snippets at all times without having to retrieve the document information from the database.
Another side feature is that you can also have secured cached-documents. This means that a web document does not have to be dynamic in order to be secure. Secured cached-documents will only be available to web users that have access to those pages cached pages.
One disadvantage to this design is that there will be an increase in cached file of the document. Process these new cached documents will be "slightly" slower (in micro-seconds) than the current design used.
What do you think? Should we implement these design?