[TYPO3-english] Random DAM image with TS problem

Christian Hennecke christian.hennecke at ruhr-uni-bochum.de
Sat Jun 13 17:20:52 CEST 2009


On Sat, 13 Jun 2009 12:58:21 UTC, Krystian Szymukowicz 
<t33k.RE.MO.VE at RE.MO.VE.prolabium.com> wrote:

> 
> Christian Hennecke wrote:
> > Hello,
> > 
> > I need to select a random image from the DAM and obtain both image file 
> > path and title for later use. This works by using a CONTENT object.
> > 
> > Now the problem is that I need the *same* randomly selected file several
> > times. When I use the above TS code for file.import.cObject, a *new* 
> > file is selected every time:
> > 
> > 10 = IMAGE
> > 10 {
> >   file.import.cObject < temp.randomImageFile
> >   altText.data = register:randomImageDamTitle
> > }
> > 20 = IMAGE
> > 20 {
> >   file.import.cObject < temp.randomImageFile
> >   offset = 250,0
> >   altText.data = register:randomImageDamTitle
> > }
> > 
> > Any idea how to do the selection only once? I guess I don't see the 
> > forest for the trees here...
> 
> I am not sure if this will work but can you try what will happen if you 
> make the following?
> 
> 10 = LOAD_REGISTER
> 10.myImage.cObject = IMAGE
> 10.myImage.cObject {
>     file.import.cObject < temp.randomImageFile
>     altText.data = register:randomImageDamTitle
> }
> 
> 20 = TEXT
> 20.data = register:myImage

Thanks! I already solved the problem yesterday evening and did it 
somewhat similar to your suggestion. Basically, I created a CONTENT 
object inside a COA_INT to ensure that a new selection does take place 
every time a page is called. In the render object, I load the register 
and then do everything else. That preserves the register values.
-- 
"I smell blood and an era of prominent madmen." - W.H. Auden


More information about the TYPO3-english mailing list