Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-01-20 13:44:40
- monkeynotes
- Member
- From: UK
- Registered: 2005-04-13
- Posts: 41
TXP tags in CSS?
I have made a few searches on the forum and not found my answer so I may as well ask it here. The question is simply, can you include TXP tags in the CSS at all? Basically I want to reference some images in my CSS and it is useful to use the <txp:site_url /> tag so that the site root is always correct. I can think of a few other neat things we could do if the CSS can be made dynamic.
Has any one achieved this? If so how is it done?
Offline
Re: TXP tags in CSS?
ako_cssParse is what you want.
Not sure how well it works.
Offline
#3 2007-01-20 17:39:58
- monkeynotes
- Member
- From: UK
- Registered: 2005-04-13
- Posts: 41
Re: TXP tags in CSS?
Thank you, I will check this out.
Offline
#4 2007-01-20 18:05:05
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: TXP tags in CSS?
monkeynotes wrote:
Basically I want to reference some images in my CSS and it is useful to use the <txp:site_url /> tag so that the site root is always correct.
Are you sure you need this at all? Couldn’t you just use absolute paths for your images?
You can also let php directly parse the css for more trickery – here’s an interesting article
Offline
#5 2007-01-20 19:39:06
- monkeynotes
- Member
- From: UK
- Registered: 2005-04-13
- Posts: 41
Re: TXP tags in CSS?
I would use absolute URLs but I am working on a dev site and when I push it to production I don’t want to have to alter the CSS. I have solved the problem in the interim by using relative URLs, but I still would like the ability to use TXP tags in the CSS on other projects. Thanks for the link the PHP link, I’ll have a read of that.
Offline
#6 2007-01-20 23:57:25
- NyteOwl
- Member
- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Re: TXP tags in CSS?
Mixing CSS and tags (html, txp, etc) Isn;t a great idea for either clarity, portability, or validity.
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
#7 2007-01-21 00:52:15
- monkeynotes
- Member
- From: UK
- Registered: 2005-04-13
- Posts: 41
Re: TXP tags in CSS?
I disagree, it would still be valid CSS that is spat out at the other end, I am simply proposing to pre-pass the CSS file through TXP/PHP first. As I understand it this is already happening with “css.php?s=default”. I am just asking that css.php parses TXP tags and renders them just as you would expect the normal templating engine to do.
Offline
#8 2007-01-21 19:15:51
- NyteOwl
- Member
- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Re: TXP tags in CSS?
To each his own but why have and use standards though if you aren’t going to follow them?
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
#9 2007-01-21 20:53:19
- monkeynotes
- Member
- From: UK
- Registered: 2005-04-13
- Posts: 41
Re: TXP tags in CSS?
You are missing the point. The CSS that is outputted by the css.php is valid, just as the XHTML outputted by the TXP/PHP templating engine is valid XHTML. All I am requesting is that CSS can be templated in the same way XHTML is, it would all validate when it is delivered to the browser.
Offline
#10 2007-01-21 22:29:29
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: TXP tags in CSS?
monkeynotes wrote:
I would use absolute URLs but I am working on a dev site and when I push it to production I don’t want to have to alter the CSS.
I see, yes, that’s tricky – I’d be interested in your findings also regarding the aforementioned plug-in.
Cheers martin
Offline
Pages: 1