[TYPO3-english] replacing cObject image by a different one

Henjo Hoeksma hphoeksma at stylence.nl
Thu Dec 10 14:17:57 CET 2009


On 2009-12-09 17:18:30 +0100, Henjo Hoeksma <hphoeksma at stylence.nl> said:

> Hi list,
> 
> I would like to replace an image attached to a record in some occasions.
> 
> The current image is retrieved using this TS:
> 
> 	image_stdWrap {
> 		setContentToCurrent = 1
> 		cObject = IMAGE
> 		cObject {
> 			file {
> 				import = uploads/tx_myext/
> 				import.current = 1
> 				width = 120
> 				height = 120
> 			}
> 		}
> 		ifEmpty.dataWrap = <span 
> style="color:red;font-weight:bold;">{LLL:EXT:myext/pi1/locallang.xml:no_item_image}</span>
	}

Context:
these 
> 
> records are used by multiple clients with all the same product but 
> sometimes different names (using contagged) and different images (what 
> I am working on now) because they are private label products.
> 
> I made a seperate table with overlay images attached to some of the 
> products. These records are located in the specific clients root page 
> only.
> 
> What I need to achieve is that when putting the output together for a 
> product with an image in the overlay images table, it retrieves the 
> image from that table.
> 
> Any clues? Hints? Directions?
> 
> Thanks in advance.
> 
> Henjo

Okay,

I got this far:

		cObject.stdWrap.override {
			cObject = CONTENT
			cObject {
				table = tx_myext_image
				select {
					// this pid needs to subsituted with the page root!
					pidInList = 1	
					// this needs to be dynamic
					where = product=8
					selectFields=image
				}
				
				renderObj = IMAGE
				renderObj.file {
					import.field = image
					import = uploads/tx_myext/
					width = 200c
					height = 150c
				}
				//renderObj = TEXT
				//renderObj.field = image
			}
		}

I don't understand though, why it generates an empty img tag. When I 
have it rendered as a TEXT object it displays the filename correctly. 
The file exists in the uploads folder.

Anyone?

Any ideas on how to substitute the product=8 with the current value of 
the list item (since this is part of the list item).

Thanks in advance for your thoughts...

Henjo
-- 
Stylence | webdevelopment in style
www.stylence.nl



More information about the TYPO3-english mailing list