[TYPO3-english] PAGE in COA_INT?

Loek Hilgersom loek at netcoop.nl
Wed May 14 17:54:52 CEST 2014


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" />|
>


More information about the TYPO3-english mailing list