-
MODX Staff
- 12,272 Posts
Using CSS as a document allows you to have logic in your PHP and to dynamically change it with snippets.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
-
MODX Staff
- 10,725 Posts
You can use this technique to generate any kind of content dynamically. I’ve used it to generate various XML formats, including RSS, GeoRSS, and several proprietary formats for custom applications (Flash remoting, AJAX, etc.), JSON responses for AJAX requests, traditional javascript files, and even dynamic graphs generated as .gif’s. Any content you can produce with a PHP script is fair game.
Wouldn’t it speed-wise be better if css and js-files are static documents instead of being parsed by the modx-engine?
I would think that it’s only when you need to have the css and js to dynamically adapt to your content that having these in the database/document tree would be beneficial.
-
MODX Staff
- 12,272 Posts
It would indeed likely be faster to have js/css as static regular old files on the filesystem. But if you turn on caching, then that kinda-sorta happens, though with a tiny bit more overhead. You could then cache the documents but call the always changeable bits uncached.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me