Hi Jacco,

For performance reasons I wouldn't put the burden of generating anything random onto TYPO3.

I often use a small PHP script that generates a random stylesheet. You can link it from TS using page.headerData (to allow adding the parameters, but also to avoid any minifiers trying to compile it into 1 static CSS file).

Another way would be to use Javascript to select a random image.

The only disadvantage of these methods is that you need some preprocessing if you want the images to get scaled and cropped automatically. If necessary you could create some extension or backend module to do that for you.

I just uploaded the latest version to github:
See https://github.com/netcoop/random-image.css.php

It's got some features which you to use it on multiple directories and CSS-selectors of choice, and a debug option.

Cheers,
Loek




On 14-05-14 17:03, Jacco van der Post wrote:
Hi!

Is seems not possible to put a PAGE object in a COA_INT?

I am trying to create dynamic CSS for a random background image to get rid of
inline CSS. If I do this without COA_INT it works, but it gets cached in the
browser (unless hard refresh).

When putting the bgCss in a COA_INT it doesn't work.


#bgCss = COA_INT
#bgCss.10 = PAGE
#bgCss.10 {

bgCss = PAGE
bgCss {
     typeNum = 22
     config {
     additionalHeaders = Content-type: text/css
     disableAllHeaderCode = 1
     }
     stdWrap.required = 1
     stdWrap.wrap = |
     10 = TEXT
     10.value (
     body {
     )
     20 = IMG_RESOURCE
     20 {
         file.import.filelist  = fileadmin/user_upload/Achtergrond_afbeeldingen/
| jpg,jpeg,gif,png | name | | 1
         file.import.listNum = rand
         stdWrap.wrap = background-image: url('/|');}
     }
}

page.headerData.10 = COA_INT
page.headerData.10.10 = TEXT
page.headerData.10.10.dataWrap = <link rel="stylesheet" type="text/css"
href="index.php?id={field:uid}&type=22" />|

_______________________________________________
TYPO3-english mailing list
TYPO3-english@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english

Reply via email to