I don’t understand this non-blank CSS documents question. You can create a Template with just [*content*] in it to use for CSS Resources like you can any type of Resource. And you can attach Template Variables to them as well, though I’m not sure that is exactly what you want since the Template Variable values would come from the CSS Resource itself, and not the HTML Resources that load this CSS Resource. What you probably want is a Snippet to grab Template Variable values for a current HTML Resource inside the CSS Resource. This could be done by passing the current Resource id into the CSS element via GET parameters, e.g.
1. With a complete rewrite for Revolution: Are their real css documents (non blank)? So that you can include template variables? (Can I look forward to this?)
<link type="text/css" rel="stylesheet" href="[~20~]&resource=[*id*]" media="all" />
A CSS Resource works like any other in MODx, so Snippet calls (and Template Variable calls) work the same, except you have to realize that the CSS Resource has it’s own id and does not automatically use the id of the HTML Resource which is loading the CSS. See the example above on how to send the current Resource id into a MODx CSS Resource.
2. Are there any snippets that can serve as a work around to this situation? I can not find any. I can not get template variable or snippet calls to work in (blank) css document.
Again, you can create a dynamic MODx CSS Resource like you can any MODx Resource with any custom Content Type.
3. Is it even possible to create or write php to modify Evolution 1.0.0 to have a real css document? Instead of utilizing a blank document with text/css?
What flexibility do you mean? Again, this idea of a "blank" CSS document method does not make sense to me. You can choose to use a Template or not.
4. For those utilizing the blank css document method - How do you maximize flexibility of the chunk calls?
You can absolutely do that, just remember the CSS Resource has it’s own id. And it is somewhat of an advantage, but this also has disadvantages: the overhead on executing PHP to return a CSS Resource is much greater than using a static CSS file served by Apache. Though you can use a snippet in CSS Resources (in Evolution; in Revolution you can configure custom headers in the Content Type itself) to alter the default MODx headers to properly handle CSS caching, passing GET parameters as in the example above will mean that caching of this CSS is per Resource, not side wide, further reducing your CSS performance. So you need to weigh the advantages and disadvantages of using dynamic CSS before deciding if this is appropriate. For instance, does the maintenance benefit of using dynamic CSS Resources outweigh the disadvantages of additional loading time for your pages. If you are developing a high-performance site for high-traffic, the answer is a resounding no as it will limit your ability to optimize load times and server resource utilization.
My typical non dynamic - CSS methodology has always been to create a global style sheet that drives all the framework, navigation and fonts
and then call in one or two additional page specific style sheets that control page specific structure changes.
for example:
<style type="text/css">
@import "css/global.css";
@import "css/contact.css";
@import "css/form.css";
</style>
What I can see as the major advantage of template variables embedded in a css a document is the ability to dynamically assemble pieces of css called from the database.
<link type="text/css" rel="stylesheet" href="[~20~]&resource=[*id*]" media="all" />
Your intent is perfectly clear to me; I’m trying to clear up your confusion from the false statement that a CSS Resource must have no template (i.e. empty). As I described, you can create a template with just the [*content*] tag in it and create all the Template Variables you want, but the caveats I described are what Susan means when she says that Template Variables won’t work in CSS Resources. Because the Template Variables would be associated with the CSS Resource and not the HTML Document from which you are calling it from.
@opengeek:
Thank you very much for the comment.
Judging by your response I’ve created some confusion.
I do apologize and will utilize your response to help clarify my intent.
is the method in reference to the wiki here:
http://wiki.modxcms.com/index.php/Dynamic_CSS_with_TVs#The_Structure
This page is a tutorial on calling the modx css document into your page template through a template variable.
I do not have a problem calling the modx css document.
The problem stems from the css document.
Read through post here:
http://modxcms.com/forums/index.php/topic,5258.0.html
I get this and everything works fine as well.
Scroll down the post on the above forum post to 8:06pm post by sottwell and you will see the issue I am referring to.
But you do know how; all I did was explain the same thing they are talking about in that wiki article, with further clarification that you do not need an empty Template. You can create one and use it, but this alone does not solve your issue...
I wish I knew how. I would not intentionally waste everyones time.
Can you point me to a tutorial or wiki?
Although I’ve tried to find one it is very possible I’ve overlooked it.
Read through the post here:
http://modxcms.com/forums/index.php/topic,5258.0.html
You need to set the template to blank. It is the entire root of my problem.
Ok I think I see what you are trying to do. The trick here is in the CSS Resource, you need to use a Snippet to call the bodyID for the HTML Resource you are including the CSS Resource on (via your Template Variable method), but in order for the CSS Resource to be aware of what HTML Resource is including it, you must pass a GET variable like I described earlier.
The flexibility I refer to is being able to set page specific css rules by utilizing the template variable.
...
My needs are more geared to calling specific chunks to a master css document.
<link type="text/css" rel="stylesheet" href="[~20~]&bodyID=[*bodyID*]" media="all" />
return (isset($_GET['bodyID'] && !empty($_GET['bodyID'] ? $_GET['bodyID'] : 'default'); // set the 'default' to whatever you want if nothing is passed
#[!GetBodyID!] .two_clLft{
background: transparent url(../img/lftBgTile.gif) repeat-x scroll 0 0;
}
#[!GetBodyID!] .two_cLRgt{
background: transparent url(../img/rgtBgTile.gif) repeat-x scroll 0 0;
}
<link type="text/css" rel="stylesheet" href="[~20~]&resource=[*id*]" media="all" />
$resource = $_GET['resource'];
return $modx->runSnippet('GetField', array('docid' => $resource, 'field' => 'bodyID'));