Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-07-24 18:46:16

firago
Member
Registered: 2005-01-03
Posts: 54

Possible To Put Conditional Comments In Stylesheet?

I was wondering if it were possible to put a conditional comment in the stylesheet in the style subtab. Thank You.

Offline

#2 2007-07-24 20:04:00

reid
Member
From: Atlanta, Ga.
Registered: 2004-04-04
Posts: 224
Website

Re: Possible To Put Conditional Comments In Stylesheet?

If you mean IE-specific conditional comments they are based on HTML comments and therefore won’t work within a stylesheet, they have to be placed within your HTML.

If you mean conditionals in txp tags, you might look into ako_cssparse

Last edited by reid (2007-07-24 20:04:48)


TextPattern user since 04/04/04

Offline

#3 2007-07-25 00:45:30

firago
Member
Registered: 2005-01-03
Posts: 54

Re: Possible To Put Conditional Comments In Stylesheet?

Hmm… I don’t think the plugin does what I want it to yet, but it is close (“this plugin does not yet work with article related tags”). I would like to be able to change the value of a property if a custom field has been filled out, and if so what it has been filled with.

For example: #wrapper {background-image:superimage<txp:if_custom_field name="special-field" val=""><txp:else />-<txp:custom_field name="special-field" /></txp:if_custom_field>.jpg;}
So if there was no “special-field” declared the code would read #wrapper {background-image:superimage.jpg;}
And if the “special-field” were named “cutedoggy” then the code would read #wrapper {background-image:superimage-cutedoggy.jpg;}

I hope that makes sense and hope somebody is able to help me. Thank you.

Offline

#4 2007-07-25 04:10:46

reid
Member
From: Atlanta, Ga.
Registered: 2004-04-04
Posts: 224
Website

Re: Possible To Put Conditional Comments In Stylesheet?

That sounds like a case for inline styles:

<div id="wrapper" style="background-image:superimage<txp:if_custom_field name="special-field">-<txp:custom_field name="special-field" /><txp:else /></txp:if_custom_field>.jpg;">


TextPattern user since 04/04/04

Offline

#5 2007-07-25 14:07:04

firago
Member
Registered: 2005-01-03
Posts: 54

Re: Possible To Put Conditional Comments In Stylesheet?

Thank you so much for your help. With your advice I was able to accomplish what I wished to.

Offline

Board footer

Powered by FluxBB