Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-10-31 15:42:56
- panicprone
- New Member
- Registered: 2007-10-31
- Posts: 2
Adding code to css
Hello guys,
I want to know how I can add some “css-code” to the used stylesheet.
I have a variable looks like this:
$css_code = ' .element { border: 1px solid black; background-color: blue; } ';
My question is: how can I add this code to the stylesheet which textpattern currently uses for the site (e.g. default).
My goal is to automatically add the code in that variable to the stylesheet when inserting the plugin-tag in a form or page.
Hope you understand me.
Greetz
Jo
Offline
Re: Adding code to css
I think that code is not supported in txp stylesheets Can you not add a php snippet in the head of the template and if the condition is met to load another stylesheet?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Adding code to css
Didn’t quite follow what you want to do but one of these two plugins I think may help you achieve what you want:
- Use txp tags in the css pane with ako_cssparse
- conditional stylesheets on a per-article basis using ajw_custom_css
TXP Builders – finely-crafted code, design and txp
Offline
#4 2007-10-31 17:11:09
- panicprone
- New Member
- Registered: 2007-10-31
- Posts: 2
Re: Adding code to css
Okay, just to make it a bit more clearer:
I’m writing a plugin which self-closing tag outputs a div with some content inside.
A class is assigned to this div and I want to use this class to format the div with css.
The div always should have a fixed position so that it appears always at the same position on the site.
The user of the plugin does’t need to style the div himself.
There’s no need for it because if the div has a custom style it doesn’t make sense in the context I use it.
I have the opportunity of styling the div with the style attribute but I don’t want to use inline-styles if I have the choice.
So I want to exclude the style information to the css file, in detail to attach the style I mentioned above to the custom stylesheet of the user.
Is that explanation better?
Thx in advance
Jo
Offline
Pages: 1