Quote from: BobRay at Mar 05, 2009, 11:17 AM
Quote from: TobyL at Mar 05, 2009, 05:17 AM
I’ve used this on occasion for stylesheets. It’s a very simple way of delivering stylesheets where I wanted modx tags to be parsed without having to embed the styles in the document itself .
Can you describe that process in more detail for me. I think I understand, but I’m not sure.
It’s the same concept as with any HTML, XML, or plain text Content Type; you use MODx Tags to dynamically construct the output, regardless of how it is done and what the resulting content is. It can even be binary content. And there is now a way to set custom HTTP response headers for each Content Type you define, though this may need some testing and interface work.
This allows CSS or even javascript files to be dynamically constructed, just like regular HTML documents, managed in the MODx tree, and referenced like any other document in the content, e.g.
<script type="text/javascript" src="[[~27]]" />
where the content for Resource 27, assigned a Content Type that has a mime-type of text/javascript, might look like something like...
myDynamicVariable = [[!GetMyDynamicVariableValue]];
That’s a bit oversimplified for brevity, but I think you get the idea.
Same thing can be done with, for instance images. You just use a script to produce the output, even if it’s a Static Resource with a binary Content Type that just echo’s the contents of a file to the browser.