[TYPO3] Retrieving data to TS from cObj->stdWrap()

Ralf Hettinger ng at ralfhettinger.de
Wed Aug 9 18:32:11 CEST 2006


Hi Terkild,

Supposing you're talking about a FE (plugin):

The problem is, that the cObj known by default in your (frontend)-extension
doesn't know anything about your extension's data by default, since this cObj
is the parent content object (very probably a content element of CType
'plugin') and therefore just a 'container' for your application.

You should instantiate your "own" cObj in your extension's code and fill it
with the data known to your extension first, and afterwards use that cObj to
do stdWrap:

// instance of class tslib_cObj, having stdWrap()
$local_cObj = t3lib_div::makeInstance('tslib_cObj');

// initialize your application's data using the piBase-defaults:
 // row $this->internal['currentRow'] of
 // table $this->internal['currentTable']
$local_cObj->start($this->internal['currentRow'],$this->internal['currentTable']);

// do a wrap of field $field, using the TS-config passed to the extension
 // tx_myextension
 // by plugin.tx_myextension.item_image.[->stdWrap]
$local_cObj->stdWrap(
  $this->internal['currentRow'][$field],
  $conf['item_image.']
);

Terkild schrieb:
> Greetings newsgroup,
> 
> Im currently writing an extension that during the output process is
> calling cObj->stdWrap() on my values retrieved from the database, and i
> have figured out how to add a wrap or format it as date etc. but when i
> try to add a postCObject i can't seem to find out how to retrieve the
> value.
> 
> E.g. i want to show an image with the name submitted through
> cObj->stdWrap(), i have tried the following code, without luck:
> 
> item_image.postCObject = IMAGE
> item_image.postCObject.file.import = uploads/tx_myextension/
> item_image.postCObject.file.import.current = 1
> item_image.postCObject.file.import.listNum = 0
> 
> Any suggestions how i can solve the problem?
> 
> Thanks in advance!
> 
> Kind Regards
> Terkild
> 



More information about the TYPO3-english mailing list