[TYPO3] Parsing CSS files - is it possible?

Christopher bedlamhotel at gmail.com
Tue May 23 18:41:16 CEST 2006


On 5/23/06, JoH <info at cybercraft.de> wrote:
> > Is it possible to parse a CSS file and replace some parts of it like
> > with a template file?
> > I mean, I'm trying to attach a CSS file for an extension, but inside
> > the file there is a background-image declaration and the image path
> > should be changed depends on where the extension is installed
> > (relatively to the site path).
> > Is it possible?
>
> As a preview of the upcoming TYPO3 cookbook you might want to try this ;-)
>
> page.headerData.100 = COA
> page.headerData.100 {
>     wrap = <style>|</style>
>     10 = TEMPLATE
>     10 {
>         template = FILE
>         template.file = /path/to/your/cssfile.css
>         marks {
>             BACKGROUNDIMAGE = IMG_RESROURCE
>             BACKGROUNDIMAGE {
>                 # your image definition here
>             }
>         }
>     }
> }
>
> You just have to insert the marker ###BACKGROUNDIMAGE### into your css file.
>
> It is even possible to include the CSS file by using another typeNum for the
> generation, but you should only use the dynamic parts in this one while
> keeping the rest in a static file, since those dynamic sheets have to be
> generated for each page separately.
>
> page.headerData.100 = TEXT
> page.headerData.100 {
>       dataWrap = <link rel="stylesheet" type="text/css"
> href="index.php?id={TSFE:id}&amp;type=123" />
> }
>
> myDynamicCSS = PAGE
> myDynamicCSS {
>     typeNum = 123
>     config {
>         disableAllHeaderCode = 1
>         additionalHeaders = Content-type: text/css
>         admPanel = 0
>     }
>     #Your Stylesheet setup here
> }



Superb.


-Christopher



More information about the TYPO3-english mailing list