The is more than one way to achieve this.
You can user a TV for example:
Adding a TV [tt][*myCSS*][/tt] to your template.
And fill in the desired CSS for the document.
Greetz
JUSI
You can also use a simple snippet with this code. Put it in the content section of the document.
$modx->regClientCSS('path_to_css_file');
http://svn.modxcms.com/docs/display/revolution/modX.regClientCSS
-
☆ A M B ☆
- 2,475 Posts
Can I suggest something simpler? CSS is all about cascading... overriding... extending... why not just style that one page using a simple style tag? Or are you concerned that your users will screw it up?
Dear all,
Thank for your propositions !!
All are very interesting and it helps!
Pierrot
Ok then I am trying this
I create a template variable called [*css-selector*]
and
I craete a snipest with this code, and I trying to get the value of the template varaiable.
<?php
$css-selector = $modx->getTemplateVar(’languages’, "", $modx->documentIdentifier);
$modx->regClientCSS(’$css-selector[value]’);
?>
But it does not work
I think my problem is when I tried to get the TV with the getTemplateVar function
What do you think
Thank
Try echoing $css-selector to see what it is set to.
Even easier...
use class="purple" in your div
and then use background-color: purple; in your CSS file...
only that div or any div with that class will have
a purple background...
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner
-
☆ A M B ☆
- 24,524 Posts
From the looks of your code, the $css-selector is an array; you can’t echo an array. At best all you get is "Array". Try this
echo "<pre>";
print_r($css-selector);
echo "</pre>";
Also, when going for a specific array value, you should enclose it in single-quotes
Otherwise you get PHP warnings and stuff, which may cause MODx to not display anything.