[Typo3] build filepath from uid - how?

JoH info at cybercraft.de
Wed Sep 28 10:34:44 CEST 2005


> Can't find the solution to this - hopefully - simple problem. One
> image has to be shown on each page and the name corresponds to the
> page id. For page 59 this looks like:
>
> page.110 = IMAGE
> page.110 {
>   file = fileadmin/pics/id59.gif
> }
>
> I'm looking for the right expression similar to:
>
>   file = fileadmin/pics/id{field:uid}.gif
>
> How?

Since "file" itself has no stdWrap properties available you have to use
"import" in this case:

page.110 = IMAGE
page.110 {
   file {
       import = fileadmin/pics/
       import.dataWrap = id{page:uid}.gif
}

But I would prefer to do it independently from the uid by using the page
type "adavanced" and uploading the image to the page.
Then you can use "levelmedia" and slide.

page.110 = IMAGE
page.110 {
   file {
       import = uploads/media/
       import.data = levelmedia:-1, slide
       import.listNum = 0
}

This will get the image from the current page or (if there is none) go back
down the rootline until it finds one.

> And in general: How can I concatenate strings in typoscript?

In general you can use "dataWrap" _if_ the TS element or parameter you are
using has got stdWrap properties:

10 = COA
10 {
    10 = TEXT
    10.dataWrap = This is a UID:{page:uid} and this another field:
{field:whatever} and a value from a register: {register:whatever}
}

But you should be aware that some other stdWrap properties won't work since
they are "before" the dataWrap in the PHP function's case.
This is why I created the example with a COA so that you can add all the
other stdWrap properties to the COA and _not_ the TEXT element itself.

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.openbc.com/go/invuid/Jo_Hasenau





More information about the TYPO3-english mailing list