One of the reasons I love MODx is the templating side of things - The templates, chunks, snippets etc work in a very similar way to a CMS I started t build myself - It recursed over the docuument untill all recognised tags had been parsed. One thing I wanted to do was to have some delays, so that I could retrospecivly add stuff back into the document if logic that was to execute later made it necessary.
For example, If a snippet was to output the html for some jQuery based tabs, I would want the html to include another CSS file, jQuery and the Tabs plugin (if not already included); and I would want this in the <head></head> section
Is there any way to do this in MODx?
You can inject CSS and JS into the head section of a page from inside a snippet with the $modx->regClientCSS() and $modx->regClientStartupScript methods. You can insert content anywhere on a page dynamically with a snippet using $modx->setPlaceholder() and putting placeholder tags on the page.