Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-18 08:48:30

nmerriam
New Member
From: Austin, TX USA
Registered: 2006-02-10
Posts: 8
Website

TXP processing code in sytlesheet?

Textpattern seems to just hand the stylesheet to the browser without any processing — does anyone know of a way to have Textpattern process the stylesheet for txp tags before it is sent? Right now I’m doing some background images, and I’d love to be able to use a <TXP: tag /> in the style sheet to update the bgimage for me. It suddenly occurs to me that I could just add that particular style to the head of the document rather than having it in the separate CSS, but that’s not very elegant.

Any ideas or pointers of how to use Textpattern to change CSS on the fly?

Last edited by nmerriam (2006-02-18 22:02:29)

Offline

#2 2006-02-18 21:34:12

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: TXP processing code in sytlesheet?

The missing code between the above paragraphs is:

&lt; pre &gt;&lt; TXP: tag / &gt;&lt; /pre &gt;

Last edited by NyteOwl (2006-02-18 21:36:47)


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#3 2006-02-18 22:03:23

nmerriam
New Member
From: Austin, TX USA
Registered: 2006-02-10
Posts: 8
Website

Re: TXP processing code in sytlesheet?

D’oh! I thought I’d checked that the code got through. Thanks for the catch.

Offline

#4 2006-07-11 17:01:55

Myjestic
Member
Registered: 2006-04-22
Posts: 17

Re: TXP processing code in sytlesheet?

Mh, this doesn´t seem to work for me…

I´ve inserted “< pre >< TXP: tag / >< /pre >” into the CSS file but it doesn´t work.

How can I insert PHP Code into the CSS file.

I want to avoid a background picture from being cached. So I would like to attach something like “../images/xyz.gif?< ?=time();? >”

How can I put this into effect?

Offline

#5 2006-07-11 17:49:48

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: TXP processing code in sytlesheet?

You’d need a plugin, and you’d place your PHP inside the Textpattern php tag.

Offline

#6 2006-07-11 19:20:41

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: TXP processing code in sytlesheet?

Realize that (if it’s important to you) that this kind of CSS hacking will result in an invalid stylesheet.


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#7 2006-07-11 19:43:41

Myjestic
Member
Registered: 2006-04-22
Posts: 17

Re: TXP processing code in sytlesheet?

@Mary
Perfect! Thanks a lot.

i had to chance the following line:
return(hu .'?ako_cssParse=true&amp;ako_cssParseName='.$name);

to this one:
return(hu .'?ako_cssParse=true&ako_cssParseName='.$name);

otherwise the implemetation will not work, with the coded ampersand

@NyteOwl
I´ve tested it with the W3C Stylesheet Validator. Everthing is okay.

Last edited by Myjestic (2006-07-11 19:56:00)

Offline

#8 2006-07-11 20:00:48

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: TXP processing code in sytlesheet?

Odd. The wonderful world of software heh :)


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#9 2006-07-12 13:52:39

Myjestic
Member
Registered: 2006-04-22
Posts: 17

Re: TXP processing code in sytlesheet?

There is a Problem with the ampersand I mentioned above.

If it is not coded, the sourcecode is not valid.

But if I replace & with &amp; MSIE will not implement the stylesheet.

Any ideas?

Offline

#10 2006-07-14 13:32:12

Myjestic
Member
Registered: 2006-04-22
Posts: 17

Re: TXP processing code in sytlesheet?

Exasperating!
If I type a CSS url with an $amp; within the CSS @import rule the browser will not decode the ampersand to & and fails to import the CSS file.
If I type it with & everthing works fine.

This one doesn’t work:
<code>
<style type=“text/css”>
@import “http://MYURL/?ako_cssParse=true&amp;ako_cssParseName=standard” screen;
</style>
</code>

This one works:
<code>
<style type=“text/css”>
@import “http://MYURL/?ako_cssParse=true&ako_cssParseName=standard” screen;
</style>
</code>

Does someone know how to get a grip on it ?

Offline

#11 2006-07-14 15:45:36

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: TXP processing code in sytlesheet?

It doesn’t work because by definition type text/css is plain ascii text and as such is not parsed by the browsers rendering engine so html entities are handled as text literals.

Use the second one if it works.


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#12 2006-07-14 15:58:05

Myjestic
Member
Registered: 2006-04-22
Posts: 17

Re: TXP processing code in sytlesheet?

ah okay,

but uncoded ampersands are not valid.

I use the <code>@import</code> rule to hide CSS from older browsers.

Better valid. I do it with <code>link href=”…</code> know.

Anway thx.

Offline

Board footer

Powered by FluxBB