It would be possible to make a simple snippet to allow editing of an external stylesheet, and indeed every page can have its own template if you like. In fact, I was just introduced to the idea of using a snippet in the template form, and that snippet simply "include"s an external template file, which can now be edited in the editor of choice (via ftp) or again could be edited through a snippet. I suspect this would have a considerable performance issue on a busy site, but it’s something to consider under circumstances like this.
Hm...I wonder if it would be possible to add a feature in QuickEdit to open a different document in QuickEdit; then you could have an option in QuickEdit to open the css document for the template of the document currently being viewed.
Quote from: Colin at Apr 18, 2006, 11:30 AM
Would something like this really have such a large overhead? - I can appreciate that any editing involving the manager somehow, will hit the server, but how much editing there be? It will just be the blogger, and only when they are editing their template/CSS.
MODx has to go to the database first anyway to get the document’s template, then if that template has an include, it has to go to the filesystem for the include file. Disk access is the most "expensive" thing you can do; you are more than doubling the time it takes before parsing can even begin. You would have to judge whether or not the site will be busy enough to really impact performance.
Chunks don’t add that much overhead, honestly. And if they stay the same on the template, then they can be cached, so it’s not a lot of extra load. You might want to investigate the regclient API functions for dynamically registering CSS on the page.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
You can use a TV that simply outputs the name of the css file, and then edit that name for every page you want a different css file for, or use @INHERIT. Or have your css as documents, and use @DOCUMENT, or chunks and use @CHUNK!
-
- 216 Posts
Hi,
I’ve only just managed to come back to this, and find that I’m still a little unsure of how use modx functions for a dynamic CSS file.
I anticipate that I will have different documents for page-specific CSS (for some small blocks), and these will be via a call from my main template. I understand the basic idea, that it will somehow be based upon the ID of specific page, but I can’t find enough explanation in the documentation. If I’ve not been clear, I’d like to use just one template, and for that to automatically obtain the correct CSS file for some small blocks that I will have dotted around different pages. This CSS will be different for every page, so this is why I need to do it this way.
Thanks.